ZF\Console\Application::setupHelpCommand PHP Méthode

setupHelpCommand() protected méthode

Creates the route, and maps the command.
protected setupHelpCommand ( ZF\Console\RouteCollection $routeCollection, ZF\Console\DispatcherInterface $dispatcher )
$routeCollection ZF\Console\RouteCollection
$dispatcher ZF\Console\DispatcherInterface
    protected function setupHelpCommand(RouteCollection $routeCollection, DispatcherInterface $dispatcher)
    {
        $help = new HelpCommand($this);
        $routeCollection->addRouteSpec(['name' => 'help', 'route' => '[<command>]', 'description' => "Display the help message for a given command.\n\n" . 'To display the list of available commands, ' . 'call the script or help with no arguments.', 'short_description' => 'Get help for individual commands', 'options_descriptions' => ['command' => 'Name of a command for which to get help'], 'constraints' => ['command' => '/^[^\\s]+$/'], 'defaults' => ['help' => true]]);
        $self = $this;
        // PHP < 5.4 compat
        $banner = $this->banner;
        // PHP < 5.4 compat
        $footer = $this->footer;
        // PHP < 5.4 compat
        $dispatcher->map('help', function ($route, $console) use($help, $self, $banner, $footer) {
            $help($route, $console);
            return 0;
        });
    }

Usage Example

Exemple #1
0
 protected function setupHelpCommand(RouteCollection $routeCollection, Dispatcher $dispatcher)
 {
     if ($dispatcher instanceof AppDispatcher) {
         return parent::setupHelpCommand($routeCollection, $dispatcher);
     }
 }