コード例 #1
0
 /**
  * Converts a path into a route.  Returns false if the route is invalid.
  *
  * @param  array $path
  * @return array $route
  */
 protected function _path_to_route($path)
 {
     if (!is_array($path) || count($path) < 1) {
         return false;
     }
     $route = array();
     while (count($path)) {
         $route[] = array_shift($path);
         $so_far = implode($this->delimiter, $route);
         if (!isset($this->routes[$so_far])) {
             return false;
             //bad route
         }
         $cls = $this->routes[$so_far];
         $type = Rframe_Resource::get_rel_type($cls);
         if (count($path) && $type == Rframe_Resource::ONE_TO_MANY) {
             array_shift($path);
             //remove a UUID
         }
     }
     return $route;
 }