|
| 1 | +<?php declare(strict_types=1); |
| 2 | +/** |
| 3 | + * This file is part of the Docker-PHP-Toolbox package. |
| 4 | + * |
| 5 | + * For the full copyright and license information, please view the LICENSE |
| 6 | + * file that was distributed with this source code. |
| 7 | + */ |
| 8 | +namespace Bartlett\PHPToolbox\Console\Command; |
| 9 | + |
| 10 | +use Bartlett\PHPToolbox\Console\ApplicationInterface; |
| 11 | + |
| 12 | +use Symfony\Component\Console\Command\Command; |
| 13 | +use Symfony\Component\Console\Input\InputInterface; |
| 14 | +use Symfony\Component\Console\Output\OutputInterface; |
| 15 | +use Symfony\Component\Console\Style\SymfonyStyle; |
| 16 | + |
| 17 | +use function sprintf; |
| 18 | + |
| 19 | +/** |
| 20 | + * Shows short information about this package. |
| 21 | + * |
| 22 | + * @since Release 1.4.0 |
| 23 | + * @author Laurent Laville |
| 24 | + */ |
| 25 | +final class About extends Command implements CommandInterface |
| 26 | +{ |
| 27 | + public const NAME = 'about'; |
| 28 | + |
| 29 | + /** |
| 30 | + * {@inheritDoc} |
| 31 | + */ |
| 32 | + protected function configure(): void |
| 33 | + { |
| 34 | + $this->setName(self::NAME) |
| 35 | + ->setDescription('Shows short information about this package') |
| 36 | + ; |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | + * {@inheritDoc} |
| 41 | + */ |
| 42 | + protected function execute(InputInterface $input, OutputInterface $output): int |
| 43 | + { |
| 44 | + $io = new SymfonyStyle($input, $output); |
| 45 | + |
| 46 | + /** @var ApplicationInterface $app */ |
| 47 | + $app = $this->getApplication(); |
| 48 | + |
| 49 | + $lines = [ |
| 50 | + sprintf( |
| 51 | + '<info>%s</info> version <comment>%s</comment>', |
| 52 | + $app->getName(), |
| 53 | + $app->getInstalledVersion() |
| 54 | + ), |
| 55 | + sprintf( |
| 56 | + '<comment>Please visit %s for more information.</comment>', |
| 57 | + 'https://llaville.github.io/docker-php-toolbox/' |
| 58 | + ), |
| 59 | + ]; |
| 60 | + $io->text($lines); |
| 61 | + |
| 62 | + return self::SUCCESS; |
| 63 | + } |
| 64 | +} |
0 commit comments