src/Http/Application.php
public function run()
    {
        /** @var ResponseInterface $response */
        $response = $this->queue->handle($this->request);

        // http status
        $reasonPhrase = $response->getReasonPhrase();
        $reasonPhrase = ($reasonPhrase ? ' '.$reasonPhrase : '');
        header(sprintf('HTTP/%s %d%s', $response->getProtocolVersion(), $response->getStatusCode(), $reasonPhrase));

        // additional headers
        foreach ($response->getHeaders() as $header => $values) {
            $first = true;
            foreach ($values as $value) {
                header(sprintf('%s: %s', $header, $value), $first);
                $first = false;
            }
        }
        echo $response->getBody();
    }
public function run()
    {
        /** @var ResponseInterface $response */
        $response = $this->queue->handle($this->request);

        // http status
        $reasonPhrase = $response->getReasonPhrase();
        $reasonPhrase = ($reasonPhrase ? ' '.$reasonPhrase : '');
        header(sprintf('HTTP/%s %d%s', $response->getProtocolVersion(), $response->getStatusCode(), $reasonPhrase));

        // additional headers
        foreach ($response->getHeaders() as $header => $values) {
            $first = true;
            foreach ($values as $value) {
                header(sprintf('%s: %s', $header, $value), $first);
                $first = false;
            }
        }
        echo $response->getBody();
    }
public function run ( ) { /** @var ResponseInterface $response */ $ response = $ this -> queue -> handle ( $ this -> request ) ; // http status $ reasonPhrase = $ response -> getReasonPhrase ( ) ; $ reasonPhrase = ( $ reasonPhrase ? ' ' . $ reasonPhrase : '' ) ; header ( sprintf ( 'HTTP/%s %d%s' , $ response -> getProtocolVersion ( ) , $ response -> getStatusCode ( ) , $ reasonPhrase ) ) ; // additional headers foreach ( $ response -> getHeaders ( ) as $ header => $ values ) { $ first = true ; foreach ( $ values as $ value ) { header ( sprintf ( '%s: %s' , $ header , $ value ) , $ first ) ; $ first = false ; } } echo $ response -> getBody ( ) ; }
run a http based application
run a http based application