Esempio n. 1
0
 /**
  * @return string
  */
 public function export()
 {
     $datetime = DateTime::createFromFormat('U.u', microtime(true));
     $fileName = sprintf('%s/%s_routes_%s.csv', $this->outputDir, Package::NAME, $datetime->format('Ymd-His.u'));
     $fp = fopen($fileName, 'w');
     fputcsv($fp, ['Route name', 'URL', 'Controller', 'Action']);
     foreach ($this->routeCollection->getRoutes() as $route) {
         /* @var Route $route */
         fputcsv($fp, [$route->getName(), $route->getUrl(), $route->getController(), $route->getAction()]);
     }
     fclose($fp);
     return $fileName;
 }
 public function listAction()
 {
     $this->console->write('{ ', ColorInterface::GRAY);
     $this->console->write('ROUTE', ColorInterface::GREEN);
     $this->console->write(', ', ColorInterface::GRAY);
     $this->console->write('URL ', ColorInterface::BLUE);
     $this->console->write(', ', ColorInterface::GRAY);
     $this->console->write('CONTROLLER::ACTION', ColorInterface::RED);
     $this->console->writeLine(' }', ColorInterface::GRAY);
     $this->console->writeLine('');
     foreach ($this->routeCollection->getRoutes() as $route) {
         $this->console->write('{ ', ColorInterface::GRAY);
         $this->console->write($route->getName(), ColorInterface::GREEN);
         $this->console->write(', ', ColorInterface::GRAY);
         $this->console->write($route->getUrl(), ColorInterface::BLUE);
         $this->console->write(', ', ColorInterface::GRAY);
         $this->console->write(sprintf('%s::%s', $route->getController(), $route->getAction()), ColorInterface::RED);
         $this->console->writeLine(' }', ColorInterface::GRAY);
     }
 }