コード例 #1
0
ファイル: RegexRoute.php プロジェクト: johnnyos/johnnyos
 /**
  * Check if request matches this route.
  *
  * @param Request $request Request to check against.
  * @return bool
  */
 public function match(Request $request) : bool
 {
     // use absolute path
     if ($this->flags & self::UseAbsolutePath) {
         $path = $request->getPath();
         // use relative path
     } else {
         $path = $request->getRelativePath();
     }
     return (bool) preg_match(sprintf('/%s/', str_replace('/', '\\/', $this->path)), rawurldecode($path));
 }
コード例 #2
0
ファイル: GenericRoute.php プロジェクト: johnnyos/johnnyos
 /**
  * Check if request matches this route.
  *
  * @param Request $request Request to check against.
  * @return bool
  */
 public function match(Request $request) : bool
 {
     // use absolute path
     if ($this->flags & self::UseAbsolutePath) {
         $path = $request->getPath();
         // use relative path
     } else {
         $path = $request->getRelativePath();
     }
     return $this->path === rawurldecode($path);
 }