Example #1
0
 protected static function getFacadeAccessor()
 {
     if (!static::$__url) {
         $routes = route::getRoutes();
         static::$__url = new base_routing_urlgenerator($routes, request::instance());
     }
     return static::$__url;
 }
Example #2
0
 public function command_cache()
 {
     if ($this->files->exists(kernel::getCachedRoutesPath())) {
         $this->command_clear();
     }
     if (!$this->files->isWritable(dirname(kernel::getCachedRoutesPath()))) {
         logger::info(sprintf('Route cache path:%s cannot write', kernel::getCachedRoutesPath()));
         exit;
     }
     $routes = route::getRoutes();
     if (count($routes) == 0) {
         logger::info("Your application doesn't have any routes.");
         exit;
     }
     foreach ($routes as $route) {
         $route->prepareForSerialization();
     }
     $this->files->put(kernel::getCachedRoutesPath(), $this->buildRouteCacheFile($routes));
     logger::info("Routes cached successfully!");
 }