Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function match(Request $request)
 {
     $path = $request->getPath();
     if ($path == '') {
         return null;
     }
     if ($path[0] != '/') {
         return null;
     }
     $lastSlashPos = strrpos($path, '/');
     $prefix = substr($path, 0, $lastSlashPos + 1);
     $action = substr($path, $lastSlashPos + 1);
     if (!isset($this->routes[$prefix])) {
         return null;
     }
     $class = $this->routes[$prefix];
     if ($action == 'index') {
         return null;
     } elseif ($action == '') {
         $action = 'index';
     }
     $method = $this->capitalize($action) . 'Action';
     return RouteMatch::forMethod($class, $method);
 }