protected function buildCommand(CommandPluginInterface $commandPlugin)
    {
        $definition = $commandPlugin->getCommandDefinition();
        $argumentsAndOptions = [];

        $consoleComand = new Command($definition->getName());
        $consoleComand->setDescription($definition->getDescription());
        $consoleComand->setHelp($definition->getHelp());

        foreach ($definition->getArguments() as list($name, $mode, $description, $defaultValue)) {
            $argumentsAndOptions[] = new InputArgument($name, $mode, $description, $defaultValue);
        }

        foreach ($definition->getOptions() as list($name, $shortcut, $mode, $description, $defaultValue)) {
            $argumentsAndOptions[] = new InputOption($name, $shortcut, $mode, $description, $defaultValue);
        }

        $consoleComand->setDefinition($argumentsAndOptions);
        $consoleComand->setCode(function (InputInterface $input, OutputInterface $output) use ($commandPlugin, $consoleComand) {
            $io = new ConsoleIO($input, $output);
            $arguments = $input->getArguments();
            $options = $input->getOptions();

            $commandPlugin->setCommandEnvironment(new SymfonyCommandEnvironment($consoleComand, $output));
            $commandPlugin->executeCommand($io, $arguments, $options);
        });

        return $consoleComand;
    }
protected function buildCommand(CommandPluginInterface $commandPlugin)
    {
        $definition = $commandPlugin->getCommandDefinition();
        $argumentsAndOptions = [];

        $consoleComand = new Command($definition->getName());
        $consoleComand->setDescription($definition->getDescription());
        $consoleComand->setHelp($definition->getHelp());

        foreach ($definition->getArguments() as list($name, $mode, $description, $defaultValue)) {
            $argumentsAndOptions[] = new InputArgument($name, $mode, $description, $defaultValue);
        }

        foreach ($definition->getOptions() as list($name, $shortcut, $mode, $description, $defaultValue)) {
            $argumentsAndOptions[] = new InputOption($name, $shortcut, $mode, $description, $defaultValue);
        }

        $consoleComand->setDefinition($argumentsAndOptions);
        $consoleComand->setCode(function (InputInterface $input, OutputInterface $output) use ($commandPlugin, $consoleComand) {
            $io = new ConsoleIO($input, $output);
            $arguments = $input->getArguments();
            $options = $input->getOptions();

            $commandPlugin->setCommandEnvironment(new SymfonyCommandEnvironment($consoleComand, $output));
            $commandPlugin->executeCommand($io, $arguments, $options);
        });

        return $consoleComand;
    }
protected function buildCommand ( CommandPluginInterface $ commandPlugin ) { $ definition = $ commandPlugin -> getCommandDefinition ( ) ; $ argumentsAndOptions = [ ] ; $ consoleComand = new Command ( $ definition -> getName ( ) ) ; $ consoleComand -> setDescription ( $ definition -> getDescription ( ) ) ; $ consoleComand -> setHelp ( $ definition -> getHelp ( ) ) ; foreach ( $ definition -> getArguments ( ) as list ( $ name , $ mode , $ description , $ defaultValue ) ) { $ argumentsAndOptions [ ] = new InputArgument ( $ name , $ mode , $ description , $ defaultValue ) ; } foreach ( $ definition -> getOptions ( ) as list ( $ name , $ shortcut , $ mode , $ description , $ defaultValue ) ) { $ argumentsAndOptions [ ] = new InputOption ( $ name , $ shortcut , $ mode , $ description , $ defaultValue ) ; } $ consoleComand -> setDefinition ( $ argumentsAndOptions ) ; $ consoleComand -> setCode ( function ( InputInterface $ input , OutputInterface $ output ) use ( $ commandPlugin , $ consoleComand ) { $ io = new ConsoleIO ( $ input , $ output ) ; $ arguments = $ input -> getArguments ( ) ; $ options = $ input -> getOptions ( ) ; $ commandPlugin -> setCommandEnvironment ( new SymfonyCommandEnvironment ( $ consoleComand , $ output ) ) ; $ commandPlugin -> executeCommand ( $ io , $ arguments , $ options ) ; } ) ; return $ consoleComand ; }
Build a Symfony Console commands.

@param \Yosymfony\Spress\Plugin\CommandPluginInterface $commandPlugin

@return \Symfony\Component\Console\Command\Command Symfony Console command
Build a Symfony Console commands .