Phprest\Application::getRouter PHP Method

getRouter() public method

public getRouter ( ) : RouteCollection
return Phprest\Router\RouteCollection
    public function getRouter()
    {
        return $this->router;
    }

Usage Example

Example #1
0
 /**
  * @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);
 }
All Usage Examples Of Phprest\Application::getRouter