Пример #1
0
 /**
  * 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
 /**
  * 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);
 }