5 * Contains Drupal\Console\Core\Command\ChainCustomCommand.
8 namespace Drupal\Console\Core\Command\Chain;
10 use Symfony\Component\Console\Input\ArrayInput;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 use Symfony\Component\Console\Input\InputOption;
14 use Symfony\Component\Console\Command\Command;
15 use Drupal\Console\Core\Command\Shared\CommandTrait;
16 use Drupal\Console\Core\Command\Shared\InputTrait;
19 * Class ChainCustomCommand
21 * @package Drupal\Console\Core\Command\ChainRegister
23 class ChainCustomCommand extends Command
36 protected $description;
44 * ChainRegister constructor.
50 public function __construct($name, $description, $file)
53 $this->description = $description;
56 parent::__construct();
62 protected function configure()
65 ->setName($this->name)
66 ->setDescription($this->description)
70 InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
71 $this->trans('commands.chain.options.placeholder')
78 protected function execute(InputInterface $input, OutputInterface $output)
80 $command = $this->getApplication()->find('chain');
84 '--file' => $this->file,
87 if ($placeholder = $input->getOption('placeholder')) {
88 $arguments['--placeholder'] = $this->inlineValueAsArray($placeholder);
91 foreach ($input->getOptions() as $option => $value) {
92 if ($option != 'placeholder' && $value) {
93 if (is_bool($value)) {
96 $arguments['--'.$option] = $value;
100 $commandInput = new ArrayInput($arguments);
101 if (array_key_exists('--no-interaction', $arguments)) {
102 $commandInput->setInteractive(false);
105 return $command->run($commandInput, $output);