protected function serveAsset($assetName)
    {
        $assetPath = $this->getLocalAssetPath($assetName);

        // Rudimentary mime type detection
        $mime = 'application/octet-stream';
        $map = [
            'ico' => 'image/vnd.microsoft.icon',
            'png' => 'image/png',
            'css' => 'text/css',
        ];

        $ext = substr($assetName, strrpos($assetName, '.') + 1);
        if (isset($map[$ext])) {
            $mime = $map[$ext];
        }

        $this->server->httpResponse->setHeader('Content-Type', $mime);
        $this->server->httpResponse->setHeader('Content-Length', filesize($assetPath));
        $this->server->httpResponse->setHeader('Cache-Control', 'public, max-age=1209600');
        $this->server->httpResponse->setStatus(200);
        $this->server->httpResponse->setBody(fopen($assetPath, 'r'));
    }
protected function serveAsset($assetName)
    {
        $assetPath = $this->getLocalAssetPath($assetName);

        // Rudimentary mime type detection
        $mime = 'application/octet-stream';
        $map = [
            'ico' => 'image/vnd.microsoft.icon',
            'png' => 'image/png',
            'css' => 'text/css',
        ];

        $ext = substr($assetName, strrpos($assetName, '.') + 1);
        if (isset($map[$ext])) {
            $mime = $map[$ext];
        }

        $this->server->httpResponse->setHeader('Content-Type', $mime);
        $this->server->httpResponse->setHeader('Content-Length', filesize($assetPath));
        $this->server->httpResponse->setHeader('Cache-Control', 'public, max-age=1209600');
        $this->server->httpResponse->setStatus(200);
        $this->server->httpResponse->setBody(fopen($assetPath, 'r'));
    }
protected function serveAsset ( $ assetName ) { $ assetPath = $ this -> getLocalAssetPath ( $ assetName ) ; // Rudimentary mime type detection $ mime = 'application/octet-stream' ; $ map = [ 'ico' => 'image/vnd.microsoft.icon' , 'png' => 'image/png' , 'css' => 'text/css' , ] ; $ ext = substr ( $ assetName , strrpos ( $ assetName , '.' ) + 1 ) ; if ( isset ( $ map [ $ ext ] ) ) { $ mime = $ map [ $ ext ] ; } $ this -> server -> httpResponse -> setHeader ( 'Content-Type' , $ mime ) ; $ this -> server -> httpResponse -> setHeader ( 'Content-Length' , filesize ( $ assetPath ) ) ; $ this -> server -> httpResponse -> setHeader ( 'Cache-Control' , 'public, max-age=1209600' ) ; $ this -> server -> httpResponse -> setStatus ( 200 ) ; $ this -> server -> httpResponse -> setBody ( fopen ( $ assetPath , 'r' ) ) ; }
This method reads an asset from disk and generates a full http response.

@param string $assetName
This method reads an asset from disk and generates a full http response .