src/main/php/interceptor/AddAccessControlAllowOriginHeader.php
public function postProcess(Request $request, Response $response)
    {
        if (empty($this->allowedOriginHosts) || !$request->hasHeader('HTTP_ORIGIN')) {
            return;
        }

        $originHost = $request->readHeader('HTTP_ORIGIN')->unsecure();
        foreach ($this->allowedOriginHosts as $allowedOriginHost) {
            if (preg_match('~' . $allowedOriginHost . '~', $originHost) === 1) {
                $response->addHeader('Access-Control-Allow-Origin', $originHost);
            }
        }
    }
public function postProcess(Request $request, Response $response)
    {
        if (empty($this->allowedOriginHosts) || !$request->hasHeader('HTTP_ORIGIN')) {
            return;
        }

        $originHost = $request->readHeader('HTTP_ORIGIN')->unsecure();
        foreach ($this->allowedOriginHosts as $allowedOriginHost) {
            if (preg_match('~' . $allowedOriginHost . '~', $originHost) === 1) {
                $response->addHeader('Access-Control-Allow-Origin', $originHost);
            }
        }
    }
public function postProcess ( Request $ request , Response $ response ) { if ( empty ( $ this -> allowedOriginHosts ) || ! $ request -> hasHeader ( 'HTTP_ORIGIN' ) ) { return ; } $ originHost = $ request -> readHeader ( 'HTTP_ORIGIN' ) -> unsecure ( ) ; foreach ( $ this -> allowedOriginHosts as $ allowedOriginHost ) { if ( preg_match ( '~' . $ allowedOriginHost . '~' , $ originHost ) === 1 ) { $ response -> addHeader ( 'Access-Control-Allow-Origin' , $ originHost ) ; } } }
does the postprocessing stuff

@param  \stubbles\webapp\Request   $request   current request
@param  \stubbles\webapp\Response  $response  response to send
does the postprocessing stuff