예제 #1
0
 /**
  * preg the url
  *
  * @param  matches
  * @param  routeKey
  * @param  array routing
  * @return  array|bool false
  */
 public function pregUrl($matches, $routeKey, $routing)
 {
     $countKey = explode("/", $this->route->getUri());
     $countKeyPreg = explode("/", $routeKey);
     if (count($countKey) != count($countKeyPreg)) {
         return false;
     }
     $route = $routeKey;
     foreach ($matches[0] as $key => $match) {
         $regex = str_replace($match, "(\\S+)", $routeKey);
         $routeKey = $regex;
         $regex = str_replace("/", "\\/", $regex);
         $parameters[] = $match;
     }
     foreach ($matches[1] as $key => $match) {
         $filterParameters[] = $match;
     }
     $this->route->setParametersName($filterParameters);
     if (preg_match_all('/^' . $regex . '$/', $this->route->getUri(), $values)) {
         $config = $routing[$route];
         $config['parameters'] = $this->mergeParameters($filterParameters, $values);
         return $config;
     }
     return false;
 }