original_string: public function isCorsRequest(HttpRequest $request)
      {
          $headers = $request->getHeaders();
  
          if (! $headers->has('Origin')) {
              return false;
          }
  
          try {
              $origin = $headers->get('Origin');
          } catch (Header\Exception\InvalidArgumentException $exception) {
              throw InvalidOriginException::fromInvalidHeaderValue();
          }
  
          $originUri  = UriFactory::factory($origin->getFieldValue());
          $requestUri = $request->getUri();
  
          // According to the spec (http://tools.ietf.org/html/rfc6454#section-4), we should check host, port and scheme
  
          return (! ($originUri->getHost() === $requestUri->getHost())
              || ! ($originUri->getPort() === $requestUri->getPort())
              || ! ($originUri->getScheme() === $requestUri->getScheme())
          );
      }
code: public function isCorsRequest(HttpRequest $request)
      {
          $headers = $request->getHeaders();
  
          if (! $headers->has('Origin')) {
              return false;
          }
  
          try {
              $origin = $headers->get('Origin');
          } catch (Header\Exception\InvalidArgumentException $exception) {
              throw InvalidOriginException::fromInvalidHeaderValue();
          }
  
          $originUri  = UriFactory::factory($origin->getFieldValue());
          $requestUri = $request->getUri();
  
          // According to the spec (http://tools.ietf.org/html/rfc6454#section-4), we should check host, port and scheme
  
          return (! ($originUri->getHost() === $requestUri->getHost())
              || ! ($originUri->getPort() === $requestUri->getPort())
              || ! ($originUri->getScheme() === $requestUri->getScheme())
          );
      }
code_tokens: public function isCorsRequest ( HttpRequest $ request ) { $ headers = $ request -> getHeaders ( ) ; if ( ! $ headers -> has ( 'Origin' ) ) { return false ; } try { $ origin = $ headers -> get ( 'Origin' ) ; } catch ( Header \ Exception \ InvalidArgumentException $ exception ) { throw InvalidOriginException :: fromInvalidHeaderValue ( ) ; } $ originUri = UriFactory :: factory ( $ origin -> getFieldValue ( ) ) ; $ requestUri = $ request -> getUri ( ) ; // According to the spec (http://tools.ietf.org/html/rfc6454#section-4), we should check host, port and scheme return ( ! ( $ originUri -> getHost ( ) === $ requestUri -> getHost ( ) ) || ! ( $ originUri -> getPort ( ) === $ requestUri -> getPort ( ) ) || ! ( $ originUri -> getScheme ( ) === $ requestUri -> getScheme ( ) ) ) ; }
docstring: Check if the HTTP request is a CORS request by checking if the Origin header is present and that the
  request URI is not the same as the one in the Origin
  
  @param  HttpRequest $request
  @return bool
docstring_tokens: Check if the HTTP request is a CORS request by checking if the Origin header is present and that the request URI is not the same as the one in the Origin