protected function getAllowedOriginValue(HttpRequest $request)
    {
        $allowedOrigins = $this->options->getAllowedOrigins();

        $origin = $request->getHeader('Origin');

        if ($origin) {
            $origin = $origin->getFieldValue();
            if (in_array('*', $allowedOrigins)) {
                return $origin;
            }
            foreach ($allowedOrigins as $allowedOrigin) {
                if (fnmatch($allowedOrigin, $origin)) {
                    return $origin;
                }
            }
        }

        return 'null';
    }
protected function getAllowedOriginValue(HttpRequest $request)
    {
        $allowedOrigins = $this->options->getAllowedOrigins();

        $origin = $request->getHeader('Origin');

        if ($origin) {
            $origin = $origin->getFieldValue();
            if (in_array('*', $allowedOrigins)) {
                return $origin;
            }
            foreach ($allowedOrigins as $allowedOrigin) {
                if (fnmatch($allowedOrigin, $origin)) {
                    return $origin;
                }
            }
        }

        return 'null';
    }
protected function getAllowedOriginValue ( HttpRequest $ request ) { $ allowedOrigins = $ this -> options -> getAllowedOrigins ( ) ; $ origin = $ request -> getHeader ( 'Origin' ) ; if ( $ origin ) { $ origin = $ origin -> getFieldValue ( ) ; if ( in_array ( '*' , $ allowedOrigins ) ) { return $ origin ; } foreach ( $ allowedOrigins as $ allowedOrigin ) { if ( fnmatch ( $ allowedOrigin , $ origin ) ) { return $ origin ; } } } return 'null' ; }
Get a single value for the "Access-Control-Allow-Origin" header

According to the spec, it is not valid to set multiple origins separated by commas. Only accepted
value are wildcard ("*"), an exact domain or a null string.

@link http://www.w3.org/TR/cors/#access-control-allow-origin-response-header
@param  HttpRequest $request
@return string
Get a single value for the Access - Control - Allow - Origin header