public function isPreflightRequest(string $type, $request): bool
    {
        $requestManager = new Request($type, $request);
        switch (strtolower($type)) {
            case 'psr-7':
            case 'laravel':
            case 'symfony':
                $method = $request->getMethod();
                break;

            default:
                $method = strtolower($_SERVER['REQUEST_METHOD']);
                if ($method === 'post') {
                    if ($_method = $requestManager->getHeader('X-HTTP-METHOD-OVERRIDE')) {
                        $method = $_method;
                    }
                }
                break;
        }

        return $this->isCorsRequest($type, $request)
            && 'options' === strtolower($method)
            && $requestManager->getHeader('Access-Control-Request-Method');
    }
public function isPreflightRequest(string $type, $request): bool
    {
        $requestManager = new Request($type, $request);
        switch (strtolower($type)) {
            case 'psr-7':
            case 'laravel':
            case 'symfony':
                $method = $request->getMethod();
                break;

            default:
                $method = strtolower($_SERVER['REQUEST_METHOD']);
                if ($method === 'post') {
                    if ($_method = $requestManager->getHeader('X-HTTP-METHOD-OVERRIDE')) {
                        $method = $_method;
                    }
                }
                break;
        }

        return $this->isCorsRequest($type, $request)
            && 'options' === strtolower($method)
            && $requestManager->getHeader('Access-Control-Request-Method');
    }
public function isPreflightRequest ( string $ type , $ request ) : bool { $ requestManager = new Request ( $ type , $ request ) ; switch ( strtolower ( $ type ) ) { case 'psr-7' : case 'laravel' : case 'symfony' : $ method = $ request -> getMethod ( ) ; break ; default : $ method = strtolower ( $ _SERVER [ 'REQUEST_METHOD' ] ) ; if ( $ method === 'post' ) { if ( $ _method = $ requestManager -> getHeader ( 'X-HTTP-METHOD-OVERRIDE' ) ) { $ method = $ _method ; } } break ; } return $ this -> isCorsRequest ( $ type , $ request ) && 'options' === strtolower ( $ method ) && $ requestManager -> getHeader ( 'Access-Control-Request-Method' ) ; }
The request is perflight request.

@param string $type
@param any    $request

@return bool

@author Seven Du <shiweidu@outlook.com>
The request is perflight request .