public function send(\BearFramework\App\Response $response): void
    {
        if ($this->hasEventListeners('beforeSendResponse')) {
            $this->dispatchEvent('beforeSendResponse', new \BearFramework\App\BeforeSendResponseEventDetails($response));
        }
        if (!$response->headers->exists('Content-Length')) {
            $response->headers->set($response->headers->make('Content-Length', ($response instanceof App\Response\FileReader ? (string) filesize($response->filename) : (string) strlen($response->content))));
        }
        if (!$response->headers->exists('Cache-Control')) {
            $response->headers->set($response->headers->make('Cache-Control', 'no-cache, no-store, must-revalidate, private, max-age=0'));
        }
        http_response_code($response->statusCode);
        if (!headers_sent()) {
            $headers = $response->headers->getList();
            foreach ($headers as $header) {
                if ($header->name === 'Content-Type' && $response->charset !== null) {
                    $header->value .= '; charset=' . $response->charset;
                }
                header($header->name . ': ' . $header->value);
            }
            $cookies = $response->cookies->getList();
            if ($cookies->count() > 0) {
                $baseURLParts = parse_url($this->request->base);
                foreach ($cookies as $cookie) {
                    setcookie($cookie->name, $cookie->value, $cookie->expire, $cookie->path === null ? (isset($baseURLParts['path']) ? $baseURLParts['path'] . '/' : '/') : $cookie->path, $cookie->domain === null ? (isset($baseURLParts['host']) ? $baseURLParts['host'] : '') : $cookie->domain, $cookie->secure === null ? $this->request->scheme === 'https' : $cookie->secure, $cookie->httpOnly);
                }
            }
        }
        if ($response instanceof App\Response\FileReader) {
            readfile($response->filename);
        } else {
            echo $response->content;
        }
        if ($this->hasEventListeners('sendResponse')) {
            $this->dispatchEvent('sendResponse', new \BearFramework\App\SendResponseEventDetails($response));
        }
    }
public function send(\BearFramework\App\Response $response): void
    {
        if ($this->hasEventListeners('beforeSendResponse')) {
            $this->dispatchEvent('beforeSendResponse', new \BearFramework\App\BeforeSendResponseEventDetails($response));
        }
        if (!$response->headers->exists('Content-Length')) {
            $response->headers->set($response->headers->make('Content-Length', ($response instanceof App\Response\FileReader ? (string) filesize($response->filename) : (string) strlen($response->content))));
        }
        if (!$response->headers->exists('Cache-Control')) {
            $response->headers->set($response->headers->make('Cache-Control', 'no-cache, no-store, must-revalidate, private, max-age=0'));
        }
        http_response_code($response->statusCode);
        if (!headers_sent()) {
            $headers = $response->headers->getList();
            foreach ($headers as $header) {
                if ($header->name === 'Content-Type' && $response->charset !== null) {
                    $header->value .= '; charset=' . $response->charset;
                }
                header($header->name . ': ' . $header->value);
            }
            $cookies = $response->cookies->getList();
            if ($cookies->count() > 0) {
                $baseURLParts = parse_url($this->request->base);
                foreach ($cookies as $cookie) {
                    setcookie($cookie->name, $cookie->value, $cookie->expire, $cookie->path === null ? (isset($baseURLParts['path']) ? $baseURLParts['path'] . '/' : '/') : $cookie->path, $cookie->domain === null ? (isset($baseURLParts['host']) ? $baseURLParts['host'] : '') : $cookie->domain, $cookie->secure === null ? $this->request->scheme === 'https' : $cookie->secure, $cookie->httpOnly);
                }
            }
        }
        if ($response instanceof App\Response\FileReader) {
            readfile($response->filename);
        } else {
            echo $response->content;
        }
        if ($this->hasEventListeners('sendResponse')) {
            $this->dispatchEvent('sendResponse', new \BearFramework\App\SendResponseEventDetails($response));
        }
    }
public function send ( \ BearFramework \ App \ Response $ response ) : void { if ( $ this -> hasEventListeners ( 'beforeSendResponse' ) ) { $ this -> dispatchEvent ( 'beforeSendResponse' , new \ BearFramework \ App \ BeforeSendResponseEventDetails ( $ response ) ) ; } if ( ! $ response -> headers -> exists ( 'Content-Length' ) ) { $ response -> headers -> set ( $ response -> headers -> make ( 'Content-Length' , ( $ response instanceof App \ Response \ FileReader ? ( string ) filesize ( $ response -> filename ) : ( string ) strlen ( $ response -> content ) ) ) ) ; } if ( ! $ response -> headers -> exists ( 'Cache-Control' ) ) { $ response -> headers -> set ( $ response -> headers -> make ( 'Cache-Control' , 'no-cache, no-store, must-revalidate, private, max-age=0' ) ) ; } http_response_code ( $ response -> statusCode ) ; if ( ! headers_sent ( ) ) { $ headers = $ response -> headers -> getList ( ) ; foreach ( $ headers as $ header ) { if ( $ header -> name === 'Content-Type' && $ response -> charset !== null ) { $ header -> value .= '; charset=' . $ response -> charset ; } header ( $ header -> name . ': ' . $ header -> value ) ; } $ cookies = $ response -> cookies -> getList ( ) ; if ( $ cookies -> count ( ) > 0 ) { $ baseURLParts = parse_url ( $ this -> request -> base ) ; foreach ( $ cookies as $ cookie ) { setcookie ( $ cookie -> name , $ cookie -> value , $ cookie -> expire , $ cookie -> path === null ? ( isset ( $ baseURLParts [ 'path' ] ) ? $ baseURLParts [ 'path' ] . '/' : '/' ) : $ cookie -> path , $ cookie -> domain === null ? ( isset ( $ baseURLParts [ 'host' ] ) ? $ baseURLParts [ 'host' ] : '' ) : $ cookie -> domain , $ cookie -> secure === null ? $ this -> request -> scheme === 'https' : $ cookie -> secure , $ cookie -> httpOnly ) ; } } } if ( $ response instanceof App \ Response \ FileReader ) { readfile ( $ response -> filename ) ; } else { echo $ response -> content ; } if ( $ this -> hasEventListeners ( 'sendResponse' ) ) { $ this -> dispatchEvent ( 'sendResponse' , new \ BearFramework \ App \ SendResponseEventDetails ( $ response ) ) ; } }
Outputs a response.

@param \BearFramework\App\Response $response The response object to output.
@return void No value is returned.
Outputs a response .