public function sendBody(ResponseInterface $response)
    {
        $range = $this->getContentRange($response->getHeaderLine('content-range'));

        $maxBufferLength = $this->getMaxBufferLength() ?: 8192;

        if ($range === false) {
            $body = $response->getBody();

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

            while (!$body->eof()) {
                echo $body->read($maxBufferLength);

                $this->delay();
            }

            return;
        }

        list($unit, $first, $last, $length) = array_values($range);

        ++$last;

        $body = $response->getBody();
        $body->seek($first);
        $position = $first;

        while (!$body->eof() && $position < $last) {
            // The latest part
            if (($position + $maxBufferLength) > $last) {
                echo $body->read($last - $position);

                $this->delay();

                break;
            }

            echo $body->read($maxBufferLength);

            $position = $body->tell();

            $this->delay();
        }
    }
public function sendBody(ResponseInterface $response)
    {
        $range = $this->getContentRange($response->getHeaderLine('content-range'));

        $maxBufferLength = $this->getMaxBufferLength() ?: 8192;

        if ($range === false) {
            $body = $response->getBody();

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

            while (!$body->eof()) {
                echo $body->read($maxBufferLength);

                $this->delay();
            }

            return;
        }

        list($unit, $first, $last, $length) = array_values($range);

        ++$last;

        $body = $response->getBody();
        $body->seek($first);
        $position = $first;

        while (!$body->eof() && $position < $last) {
            // The latest part
            if (($position + $maxBufferLength) > $last) {
                echo $body->read($last - $position);

                $this->delay();

                break;
            }

            echo $body->read($maxBufferLength);

            $position = $body->tell();

            $this->delay();
        }
    }
public function sendBody ( ResponseInterface $ response ) { $ range = $ this -> getContentRange ( $ response -> getHeaderLine ( 'content-range' ) ) ; $ maxBufferLength = $ this -> getMaxBufferLength ( ) ? : 8192 ; if ( $ range === false ) { $ body = $ response -> getBody ( ) ; if ( $ body -> isSeekable ( ) ) { $ body -> rewind ( ) ; } while ( ! $ body -> eof ( ) ) { echo $ body -> read ( $ maxBufferLength ) ; $ this -> delay ( ) ; } return ; } list ( $ unit , $ first , $ last , $ length ) = array_values ( $ range ) ; ++ $ last ; $ body = $ response -> getBody ( ) ; $ body -> seek ( $ first ) ; $ position = $ first ; while ( ! $ body -> eof ( ) && $ position < $ last ) { // The latest part if ( ( $ position + $ maxBufferLength ) > $ last ) { echo $ body -> read ( $ last - $ position ) ; $ this -> delay ( ) ; break ; } echo $ body -> read ( $ maxBufferLength ) ; $ position = $ body -> tell ( ) ; $ this -> delay ( ) ; } }
Send body as response.

@param   ResponseInterface $response Response object.

@return  void
Send body as response .