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