ZF\Console\Application::setupAutocompleteCommand PHP Method

setupAutocompleteCommand() protected method

Creates the route, and maps the command.
protected setupAutocompleteCommand ( ZF\Console\RouteCollection $routeCollection, ZF\Console\DispatcherInterface $dispatcher )
$routeCollection ZF\Console\RouteCollection
$dispatcher ZF\Console\DispatcherInterface
    protected function setupAutocompleteCommand(RouteCollection $routeCollection, DispatcherInterface $dispatcher)
    {
        $routeCollection->addRouteSpec(['name' => 'autocomplete', 'description' => 'Shows how to activate autocompletion of this command for your login shell', 'short_description' => 'Command autocompletion setup']);
        $dispatcher->map('autocomplete', function ($route, $console) {
            ob_start();
            include __DIR__ . '/../views/autocomplete.phtml';
            $content = ob_get_contents();
            ob_end_clean();
            return $console->write($content);
        });
    }

Usage Example

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