ZF\Console\Application::setupVersionCommand PHP Method

setupVersionCommand() protected method

Creates the route, and maps the command.
protected setupVersionCommand ( ZF\Console\RouteCollection $routeCollection, ZF\Console\DispatcherInterface $dispatcher )
$routeCollection ZF\Console\RouteCollection
$dispatcher ZF\Console\DispatcherInterface
    protected function setupVersionCommand(RouteCollection $routeCollection, DispatcherInterface $dispatcher)
    {
        $routeCollection->addRouteSpec(['name' => 'version', 'route' => '(--version|-v)', 'description' => 'Display the version of the script.', 'short_description' => 'Display the version of the script', 'defaults' => ['version' => true], 'prepend_command_to_route' => false]);
        $self = $this;
        // PHP < 5.4 compat
        $dispatcher->map('version', function ($route, $console) use($self) {
            return $self->showVersion($console);
        });
    }

Usage Example

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