original_string: public function checkRequestPath(Request $request, $path)
      {
          if ('/' !== $path[0]) {
              try {
                  // matching a request is more powerful than matching a URL path + context, so try that first
                  if ($this->urlMatcher instanceof RequestMatcherInterface) {
                      $parameters = $this->urlMatcher->matchRequest($request);
                  } else {
                      $parameters = $this->urlMatcher->match($request->getPathInfo());
                  }
  
                  return isset($parameters['_route']) && $path === $parameters['_route'];
              } catch (MethodNotAllowedException $e) {
                  return false;
              } catch (ResourceNotFoundException $e) {
                  return false;
              }
          }
  
          return $path === rawurldecode($request->getPathInfo());
      }
code: public function checkRequestPath(Request $request, $path)
      {
          if ('/' !== $path[0]) {
              try {
                  // matching a request is more powerful than matching a URL path + context, so try that first
                  if ($this->urlMatcher instanceof RequestMatcherInterface) {
                      $parameters = $this->urlMatcher->matchRequest($request);
                  } else {
                      $parameters = $this->urlMatcher->match($request->getPathInfo());
                  }
  
                  return isset($parameters['_route']) && $path === $parameters['_route'];
              } catch (MethodNotAllowedException $e) {
                  return false;
              } catch (ResourceNotFoundException $e) {
                  return false;
              }
          }
  
          return $path === rawurldecode($request->getPathInfo());
      }
code_tokens: public function checkRequestPath ( Request $ request , $ path ) { if ( '/' !== $ path [ 0 ] ) { try { // matching a request is more powerful than matching a URL path + context, so try that first if ( $ this -> urlMatcher instanceof RequestMatcherInterface ) { $ parameters = $ this -> urlMatcher -> matchRequest ( $ request ) ; } else { $ parameters = $ this -> urlMatcher -> match ( $ request -> getPathInfo ( ) ) ; } return isset ( $ parameters [ '_route' ] ) && $ path === $ parameters [ '_route' ] ; } catch ( MethodNotAllowedException $ e ) { return false ; } catch ( ResourceNotFoundException $ e ) { return false ; } } return $ path === rawurldecode ( $ request -> getPathInfo ( ) ) ; }
docstring: Checks that a given path matches the Request.
  
  @param Request $request A Request instance
  @param string  $path    A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo))
  
  @return bool true if the path is the same as the one from the Request, false otherwise
docstring_tokens: Checks that a given path matches the Request .