Example #1
0
 public function test()
 {
     list($uri, $verb) = array_pad($this->args, 2, null);
     if (!$uri) {
         Prompt::outputend(ANSI::fg('You must specify a URI to test.' . "\n", ANSI::RED));
         return Help::execute(Application::instance());
     }
     if (!$verb) {
         $verb = 'GET';
     }
     $this->loadRoutes(strtoupper($verb));
     $_SERVER['REQUEST_URI'] = $uri;
     foreach (Router::routes() as $route) {
         if ($route->match()) {
             Prompt::tableHeader(['Verb' => 10, 'Route' => 35, 'Name' => 20]);
             return Prompt::tableRow([strtoupper($route->verb), $route->route, $route->name !== $route->route ? $route->name : ' ']);
         }
     }
     Prompt::outputend(ANSI::fg('Route for URI ' . $uri . ' could not be found.', ANSI::RED));
     exit;
 }
Example #2
0
 /**
  * Bootstrap the application.
  */
 public static function bootstrap()
 {
     static::$instance = new static();
     static::$instance->executeCommand();
 }