/** * Dispatch a request * * @param array Argv values * @return mixed Result **/ public function dispatch(array $argv) { list($name, $arguments, $options) = $this->parser->parseInput($argv); if (empty($name)) { $name = 'list'; } $command = $this->commands->getCommand($name); if (!$command) { throw new RuntimeException("Command not found: {$name}"); } return $this->container->fireMethod($command, 'executeCommand', [$arguments, $options]); }
/** * Execute the command with the provided input * * @param Slab\Core\ContainerInterface * @param array Arguments * @param array Options * @return int Exit status **/ public function executeCommand(ContainerInterface $container, array $arguments, array $options) { // var_dump("Executing {$this->name}", $arguments, $options); // $this->setOutputter($container->make('Slab\Cli\Outputter')); return $container->fireMethod($this, $this->getExecuteMethod()); }