original_string: public function onCorsPreflight(MvcEvent $event)
      {
          // Reset state flag
          $this->isPreflight = false;
  
          /** @var $request HttpRequest */
          $request = $event->getRequest();
  
          if (! $request instanceof HttpRequest) {
              return;
          }
  
          try {
              $isCorsRequest = $this->corsService->isCorsRequest($request);
          } catch (InvalidOriginException $exception) {
              /** @var HttpResponse $response */
              $response = $event->getResponse();
              $response->setStatusCode(400);
              $response->setReasonPhrase($exception->getMessage());
              return $response;
          }
  
          // If this isn't a preflight, done
          if (! $isCorsRequest || ! $this->corsService->isPreflightRequest($request)) {
              return;
          }
  
          // Preflight -- return a response now!
          $this->isPreflight = true;
  
          return $this->corsService->createPreflightCorsResponseWithRouteOptions($request, $event->getRouteMatch());
      }
code: public function onCorsPreflight(MvcEvent $event)
      {
          // Reset state flag
          $this->isPreflight = false;
  
          /** @var $request HttpRequest */
          $request = $event->getRequest();
  
          if (! $request instanceof HttpRequest) {
              return;
          }
  
          try {
              $isCorsRequest = $this->corsService->isCorsRequest($request);
          } catch (InvalidOriginException $exception) {
              /** @var HttpResponse $response */
              $response = $event->getResponse();
              $response->setStatusCode(400);
              $response->setReasonPhrase($exception->getMessage());
              return $response;
          }
  
          // If this isn't a preflight, done
          if (! $isCorsRequest || ! $this->corsService->isPreflightRequest($request)) {
              return;
          }
  
          // Preflight -- return a response now!
          $this->isPreflight = true;
  
          return $this->corsService->createPreflightCorsResponseWithRouteOptions($request, $event->getRouteMatch());
      }
code_tokens: public function onCorsPreflight ( MvcEvent $ event ) { // Reset state flag $ this -> isPreflight = false ; /** @var $request HttpRequest */ $ request = $ event -> getRequest ( ) ; if ( ! $ request instanceof HttpRequest ) { return ; } try { $ isCorsRequest = $ this -> corsService -> isCorsRequest ( $ request ) ; } catch ( InvalidOriginException $ exception ) { /** @var HttpResponse $response */ $ response = $ event -> getResponse ( ) ; $ response -> setStatusCode ( 400 ) ; $ response -> setReasonPhrase ( $ exception -> getMessage ( ) ) ; return $ response ; } // If this isn't a preflight, done if ( ! $ isCorsRequest || ! $ this -> corsService -> isPreflightRequest ( $ request ) ) { return ; } // Preflight -- return a response now! $ this -> isPreflight = true ; return $ this -> corsService -> createPreflightCorsResponseWithRouteOptions ( $ request , $ event -> getRouteMatch ( ) ) ; }
docstring: Handle a CORS preflight request
  
  @param  MvcEvent          $event
  @return null|HttpResponse
docstring_tokens: Handle a CORS preflight request