public function output($output = '', $contentType = 'text/html', array $cookies = array())
    {
        if(!self::isTest()) {
            Logger::log('Start output response');
            ob_start();
            $this->setReponseHeaders($contentType, $cookies);
            header('Content-length: ' . strlen($output));
            header('CRC: ' . crc32($output));

            $needCache = Cache::needCache();
            $cache = Cache::getInstance();
            list($path, $cacheDataName) = $cache->getRequestCacheHash();
            if (null !== $cacheDataName && false !== $needCache && $this->getStatusCode() === Template::STATUS_OK) {
                Logger::log('Saving output response into cache');
                $cache->storeData('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName, $output);
                $cache->storeData('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName . '.headers', headers_list(), Cache::JSON);
            } elseif (Request::getInstance()->getMethod() !== 'GET') {
                $cache->flushCache();
            }
            echo $output;

            ob_flush();
            ob_end_clean();
            Logger::log('End output response');
            $this->closeRender();
        } else {
            return $output;
        }
    }
public function output($output = '', $contentType = 'text/html', array $cookies = array())
    {
        if(!self::isTest()) {
            Logger::log('Start output response');
            ob_start();
            $this->setReponseHeaders($contentType, $cookies);
            header('Content-length: ' . strlen($output));
            header('CRC: ' . crc32($output));

            $needCache = Cache::needCache();
            $cache = Cache::getInstance();
            list($path, $cacheDataName) = $cache->getRequestCacheHash();
            if (null !== $cacheDataName && false !== $needCache && $this->getStatusCode() === Template::STATUS_OK) {
                Logger::log('Saving output response into cache');
                $cache->storeData('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName, $output);
                $cache->storeData('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName . '.headers', headers_list(), Cache::JSON);
            } elseif (Request::getInstance()->getMethod() !== 'GET') {
                $cache->flushCache();
            }
            echo $output;

            ob_flush();
            ob_end_clean();
            Logger::log('End output response');
            $this->closeRender();
        } else {
            return $output;
        }
    }
public function output ( $ output = '' , $ contentType = 'text/html' , array $ cookies = array ( ) ) { if ( ! self :: isTest ( ) ) { Logger :: log ( 'Start output response' ) ; ob_start ( ) ; $ this -> setReponseHeaders ( $ contentType , $ cookies ) ; header ( 'Content-length: ' . strlen ( $ output ) ) ; header ( 'CRC: ' . crc32 ( $ output ) ) ; $ needCache = Cache :: needCache ( ) ; $ cache = Cache :: getInstance ( ) ; list ( $ path , $ cacheDataName ) = $ cache -> getRequestCacheHash ( ) ; if ( null !== $ cacheDataName && false !== $ needCache && $ this -> getStatusCode ( ) === Template :: STATUS_OK ) { Logger :: log ( 'Saving output response into cache' ) ; $ cache -> storeData ( 'json' . DIRECTORY_SEPARATOR . $ path . $ cacheDataName , $ output ) ; $ cache -> storeData ( 'json' . DIRECTORY_SEPARATOR . $ path . $ cacheDataName . '.headers' , headers_list ( ) , Cache :: JSON ) ; } elseif ( Request :: getInstance ( ) -> getMethod ( ) !== 'GET' ) { $ cache -> flushCache ( ) ; } echo $ output ; ob_flush ( ) ; ob_end_clean ( ) ; Logger :: log ( 'End output response' ) ; $ this -> closeRender ( ) ; } else { return $ output ; } }
Servicio que devuelve el output
@param string $output
@param string $contentType
@param array $cookies
@return string HTML
Servicio que devuelve el output