Ejemplo n.º 1
0
 public function listroutes(IOStream $io, $verbose = false, $flag = false)
 {
     $routes = $this->application()->getRouter()->getRoutes();
     $table = new Table(Table::CONSOLE_TABLE_ALIGN_LEFT);
     $header = ['Route', 'Method', 'Action', 'Middleware'];
     if ($flag) {
         $header[] = "Options";
     }
     $list = [];
     foreach ($routes as $method => $routesArr) {
         foreach ($routesArr as $path => $route) {
             $row = [];
             /** @var Route $route */
             $row[] = $route->getUri();
             $row[] = $method;
             $row[] = $route->getAction();
             $row[] = implode(',', $route->getMiddlewares());
             if ($flag) {
                 $this->addOptionsToTable($route, $row);
             }
             array_push($list, $row);
         }
     }
     $io->writeln($table->fromArray($header, $list));
 }
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function showTable(array $array = [])
 {
     if (empty($array)) {
         return false;
     }
     $headers = array_shift($array);
     $table = new Table();
     $this->writeln($table->fromArray($headers, $array));
 }