public function send(): Response
    {
        $http_line = sprintf(
            'HTTP/%s %s %s',
            $this->getProtocolVersion(),
            $this->getStatusCode(),
            $this->getReasonPhrase()
        );

        header($http_line, true, $this->getStatusCode());

        foreach ($this->getHeaders() as $name => $values) {
            /** @var array $values */
            foreach ($values as $value) {
                header("$name: $value", false);
            }
        }

        $stream = $this->getBody();

        if ($stream->isSeekable()) {
            $stream->rewind();
        }

        while (! $stream->eof()) {
            echo $stream->read(1024 * 8);
        }

        return $this;
    }
public function send(): Response
    {
        $http_line = sprintf(
            'HTTP/%s %s %s',
            $this->getProtocolVersion(),
            $this->getStatusCode(),
            $this->getReasonPhrase()
        );

        header($http_line, true, $this->getStatusCode());

        foreach ($this->getHeaders() as $name => $values) {
            /** @var array $values */
            foreach ($values as $value) {
                header("$name: $value", false);
            }
        }

        $stream = $this->getBody();

        if ($stream->isSeekable()) {
            $stream->rewind();
        }

        while (! $stream->eof()) {
            echo $stream->read(1024 * 8);
        }

        return $this;
    }
public function send ( ) : Response { $ http_line = sprintf ( 'HTTP/%s %s %s' , $ this -> getProtocolVersion ( ) , $ this -> getStatusCode ( ) , $ this -> getReasonPhrase ( ) ) ; header ( $ http_line , true , $ this -> getStatusCode ( ) ) ; foreach ( $ this -> getHeaders ( ) as $ name => $ values ) { /** @var array $values */ foreach ( $ values as $ value ) { header ( "$name: $value" , false ) ; } } $ stream = $ this -> getBody ( ) ; if ( $ stream -> isSeekable ( ) ) { $ stream -> rewind ( ) ; } while ( ! $ stream -> eof ( ) ) { echo $ stream -> read ( 1024 * 8 ) ; } return $ this ; }
Send the response.

@throws \RuntimeException

@return Response
Send the response .