Example #1
0
 /**
  * 
  * @access private
  * @static
  * @param string $regex
  * @param string $route
  * @return void
  */
 private static function _check($regex, $route)
 {
     if (strpos(self::$_request, '?') !== FALSE) {
         self::$_request = rtrim(strstr(self::$_request, '?', TRUE), '/');
     }
     $pattern = preg_replace('/{([\\w]+)}/Uis', '([\\w-]+)', $regex);
     $pattern = str_replace('/', '\\/', $pattern);
     if (preg_match('#^' . $pattern . '$#', self::$_request, $vals)) {
         if (strpos($route, '@') !== FALSE) {
             self::$_controller = 'c' . ucfirst(strstr($route, '@', TRUE));
             self::$_method = substr(strstr($route, '@'), 1);
         } else {
             self::$_controller = 'c' . ucfirst($route);
             self::$_method = 'index';
         }
         preg_match_all('/{([\\w]+)}/Uis', $regex, $vars);
         if ($vars[1]) {
             $row = 1;
             foreach ($vars[1] as $arg_var) {
                 self::$_args[$arg_var] = $vals[$row];
                 $row++;
             }
         }
     }
 }