function getCallable() { $callable = function () { if ($this->input->getOption('xml')) { $this->input->setOption('format', 'xml'); } $helper = new DescriptorHelper(); $helper->describe($this->output, $this->getApplication(), array('format' => $this->input->getOption('format'), 'raw_text' => $this->input->getOption('raw'), 'namespace' => $this->input->getArgument('namespace'))); }; return $callable; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { if (null === $this->command) { $this->command = $this->getApplication()->find($input->getArgument('command_name')); } if ($input->getOption('xml')) { $input->setOption('format', 'xml'); } $helper = new DescriptorHelper(); $helper->describe($output, $this->command, array('format' => $input->getOption('format'), 'raw' => $input->getOption('raw'))); $this->command = null; }
/** * Return an array of parameters that should be passed to the callable. * They should have the correct name indexes, the order does not matter * as Auryn will inject them correctly. * @param InputInterface $input * @param OutputInterface $output * @return array */ function parseInput(InputInterface $input, OutputInterface $output) { $params = []; foreach ($this->getDefinition()->getArguments() as $argument) { $name = $argument->getName(); $params[$name] = $input->getArgument($name); } foreach ($this->getDefinition()->getOptions() as $option) { $name = $option->getName(); $params[$name] = $input->getOption($name); } return $params; }