/** * @param InputInterface $input * @param OutputInterface $output * * @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); }
public function testGetters() { $this->assertInstanceOf('\\Phprest\\Config', $this->app->getConfiguration()); $this->assertInstanceOf('\\League\\Container\\ContainerInterface', $this->app->getContainer()); $this->assertInstanceOf('\\Phprest\\Router\\RouteCollection', $this->app->getRouter()); }