Example #1
0
 /**
  * @access  private
  * @param   \Phphilosophy\Router\Route  $route  A route instance
  * @param   string                      $uri    The request URI
  * @param   string                      $method The request method
  * @return  mixed
  */
 private function match($route, $uri, $method)
 {
     // The pattern given by the user
     $pattern = $route->getPattern();
     // The regular expression
     $regex = $this->patternToRegex($pattern);
     // The methods of this route
     $methods = $route->getMethods();
     // Run the callable
     if (preg_match($regex, $uri) && in_array($method, $methods)) {
         $params = $this->getParams($uri, $pattern);
         $this->match = true;
         call_user_func_array($route->getAction(), $params);
     }
 }