public function isCorsRequest(string $type, $request): bool
    {
        $origin = (new Request($type, $request))->getOrigin();

        switch (strtolower($type)) {
            case 'psr-7':
                $scheme = $request->getUri()->getScheme();
                $httpHost = $scheme.'://'.$request->getUri()->getHost();
                $port = $request->getUri()->getPort();

                if (('http' == $scheme && 80 == $port) || ('https' == $scheme && 443 == $port)) {
                    $isSameHost = $origin === $httpHost;
                    break;
                }

                $isSameHost = $origin === ($httpHost.':'.$port);
                break;

            case 'laravel':
            case 'symfony':
                $isSameHost = $origin === $request->getSchemeAndHttpHost();
                break;

            default:
                $isSameHost = false;
                break;
        }

        return $origin && !$isSameHost;
    }
public function isCorsRequest(string $type, $request): bool
    {
        $origin = (new Request($type, $request))->getOrigin();

        switch (strtolower($type)) {
            case 'psr-7':
                $scheme = $request->getUri()->getScheme();
                $httpHost = $scheme.'://'.$request->getUri()->getHost();
                $port = $request->getUri()->getPort();

                if (('http' == $scheme && 80 == $port) || ('https' == $scheme && 443 == $port)) {
                    $isSameHost = $origin === $httpHost;
                    break;
                }

                $isSameHost = $origin === ($httpHost.':'.$port);
                break;

            case 'laravel':
            case 'symfony':
                $isSameHost = $origin === $request->getSchemeAndHttpHost();
                break;

            default:
                $isSameHost = false;
                break;
        }

        return $origin && !$isSameHost;
    }
public function isCorsRequest ( string $ type , $ request ) : bool { $ origin = ( new Request ( $ type , $ request ) ) -> getOrigin ( ) ; switch ( strtolower ( $ type ) ) { case 'psr-7' : $ scheme = $ request -> getUri ( ) -> getScheme ( ) ; $ httpHost = $ scheme . '://' . $ request -> getUri ( ) -> getHost ( ) ; $ port = $ request -> getUri ( ) -> getPort ( ) ; if ( ( 'http' == $ scheme && 80 == $ port ) || ( 'https' == $ scheme && 443 == $ port ) ) { $ isSameHost = $ origin === $ httpHost ; break ; } $ isSameHost = $ origin === ( $ httpHost . ':' . $ port ) ; break ; case 'laravel' : case 'symfony' : $ isSameHost = $ origin === $ request -> getSchemeAndHttpHost ( ) ; break ; default : $ isSameHost = false ; break ; } return $ origin && ! $ isSameHost ; }
The request is CORE request.

@param string $type
@param any    $request

@return bool

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