Phprest\Command\Route\Get::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : void
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
return void
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $routes = [];
        $routingTable = $this->app->getRouter()->getRoutingTable();
        usort($routingTable, function ($a, $b) {
            return $a['route'] < $b['route'] ? -1 : 1;
        });
        foreach ($routingTable as $routingTableRecord) {
            if ($routingTableRecord['handler'] instanceof \Closure) {
                $routes[] = [$routingTableRecord['method'], $routingTableRecord['route'], 'Closure'];
            } else {
                $routes[] = [$routingTableRecord['method'], $routingTableRecord['route'], $routingTableRecord['handler']];
            }
        }
        $table = $this->getHelper('table');
        $table->setHeaders(['Method', 'Route', 'Handler'])->setRows($routes);
        $table->render($output);
    }