Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ProxyCommand | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** |
| 6 | * Fast Forward Development Tools for PHP projects. |
| 7 | * |
| 8 | * This file is part of fast-forward/dev-tools project. |
| 9 | * |
| 10 | * @author Felipe Sayão Lobato Abreu <github@mentordosnerds.com> |
| 11 | * @license https://opensource.org/licenses/MIT MIT License |
| 12 | * |
| 13 | * @see https://github.com/php-fast-forward/ |
| 14 | * @see https://github.com/php-fast-forward/dev-tools |
| 15 | * @see https://github.com/php-fast-forward/dev-tools/issues |
| 16 | * @see https://php-fast-forward.github.io/dev-tools/ |
| 17 | * @see https://datatracker.ietf.org/doc/html/rfc2119 |
| 18 | */ |
| 19 | |
| 20 | namespace FastForward\DevTools\Composer\Command; |
| 21 | |
| 22 | use Composer\Command\BaseCommand; |
| 23 | use Symfony\Component\Console\Command\Command; |
| 24 | use Symfony\Component\Console\Input\InputInterface; |
| 25 | use Symfony\Component\Console\Output\OutputInterface; |
| 26 | |
| 27 | /** |
| 28 | * Adapts migrated Symfony commands to Composer's BaseCommand contract. |
| 29 | */ |
| 30 | class ProxyCommand extends BaseCommand |
| 31 | { |
| 32 | /** |
| 33 | * @param Command $command the Symfony command adapted for Composer plugin execution |
| 34 | */ |
| 35 | public function __construct( |
| 36 | private Command $command, |
| 37 | ) { |
| 38 | parent::__construct($this->command->getName()); |
| 39 | |
| 40 | $this |
| 41 | ->setAliases($this->command->getAliases()) |
| 42 | ->setDescription($this->command->getDescription()) |
| 43 | ->setHelp($this->command->getHelp()) |
| 44 | ->setDefinition(clone $this->command->getDefinition()) |
| 45 | ->setHidden($this->command->isHidden()); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * @param InputInterface $input |
| 50 | * @param OutputInterface $output |
| 51 | * |
| 52 | * @return int |
| 53 | */ |
| 54 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 55 | { |
| 56 | return $this->command->run($input, $output); |
| 57 | } |
| 58 | } |