示例#1
0
 /**
  * Identify and return current route (based on URL from fetchUrl)
  *
  * @static
  * @access     private
  * @return    array
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 private static function identifyCurrentRoute()
 {
     foreach (static::$routesList as $routeName => $route) {
         /* @var $route Route */
         if (preg_match('%^' . $route->getURL() . '$%', static::$currentURL)) {
             Log::insert('Route identified: "' . $routeName . '"!');
             static::$currentRoute = $route;
             static::$currentRouteName = $routeName;
             return static::$currentRoute;
         }
     }
     return FALSE;
 }
示例#2
0
文件: Router.php 项目: nirix/radium
 protected static function setRoute($route)
 {
     $destination = explode('::', $route->destination);
     $info = ['controller' => $destination[0], 'method' => $destination[1], 'params' => $route->params, 'defaults' => $route->defaults, 'extension' => isset($route->params['extension']) ? $route->params['extension'] : 'html'];
     // Remove the first dot from the extension
     if ($info['extension'][0] == '.') {
         $info['extension'] = substr($info['extension'], 1);
     }
     // Allow static use current route info.
     static::$controller = $info['controller'];
     static::$method = $info['method'];
     static::$params = $info['params'];
     static::$defaults = $info['defaults'];
     static::$extension = $info['extension'];
     return static::$currentRoute = $info;
 }