src/Network/Response.php
public function render($response_sent, $status = NULL) {
        $response = $this->_parse($response_sent);

        if (is_null($status)) {
            $status = $this->getStatus($this->_default_header);
        } elseif ( !is_null($status) ) {
            $status = $this->getStatus($status);
        } elseif ( !is_null($response['status']) ) {
            $status = $this->getStatus($response['status']);
        } else {
            $status = $this->getStatus(500);
        }
        
        if ( !headers_sent() ) {
            if (!strpos(PHP_SAPI, 'cgi')) {
                header($status);
            }
            foreach ( $response['headers'] as $header ) {
                header($header, false);
            }
        }
        $length = strlen($response['body']);
        for ( $i = 0; $i < $length; $i += $this->_config['buffer_size'] ) {
            echo substr($response['body'], $i, $this->_config['buffer_size']);
        }
    }
public function render($response_sent, $status = NULL) {
        $response = $this->_parse($response_sent);

        if (is_null($status)) {
            $status = $this->getStatus($this->_default_header);
        } elseif ( !is_null($status) ) {
            $status = $this->getStatus($status);
        } elseif ( !is_null($response['status']) ) {
            $status = $this->getStatus($response['status']);
        } else {
            $status = $this->getStatus(500);
        }
        
        if ( !headers_sent() ) {
            if (!strpos(PHP_SAPI, 'cgi')) {
                header($status);
            }
            foreach ( $response['headers'] as $header ) {
                header($header, false);
            }
        }
        $length = strlen($response['body']);
        for ( $i = 0; $i < $length; $i += $this->_config['buffer_size'] ) {
            echo substr($response['body'], $i, $this->_config['buffer_size']);
        }
    }
public function render ( $ response_sent , $ status = NULL ) { $ response = $ this -> _parse ( $ response_sent ) ; if ( is_null ( $ status ) ) { $ status = $ this -> getStatus ( $ this -> _default_header ) ; } elseif ( ! is_null ( $ status ) ) { $ status = $ this -> getStatus ( $ status ) ; } elseif ( ! is_null ( $ response [ 'status' ] ) ) { $ status = $ this -> getStatus ( $ response [ 'status' ] ) ; } else { $ status = $ this -> getStatus ( 500 ) ; } if ( ! headers_sent ( ) ) { if ( ! strpos ( PHP_SAPI , 'cgi' ) ) { header ( $ status ) ; } foreach ( $ response [ 'headers' ] as $ header ) { header ( $ header , false ) ; } } $ length = strlen ( $ response [ 'body' ] ) ; for ( $ i = 0 ; $ i < $ length ; $ i += $ this -> _config [ 'buffer_size' ] ) { echo substr ( $ response [ 'body' ] , $ i , $ this -> _config [ 'buffer_size' ] ) ; } }
Renderiza la respuesta completa
@param mix $response_sent La respuesta puede ser un string con el body o un array
['body' => BODY_CONTENT, 'headers' => [HEADER_TO_SEND], 'status' => STATUS_CODE ]
@param integer $status [Opcional] El codigo de estado HTTP, por defecto es 200
Renderiza la respuesta completa