protected function getFile(WebRequest $request)
    {
        $path = realpath($this->dirRoot . DIRECTORY_SEPARATOR . $request->getPath());
        if (false === $path) {
            throw new Exceptions\HttpStatusError(
                "File not found.",
                404
            );
        }
        if (is_dir($path)) {
            $path .= DIRECTORY_SEPARATOR . $this->index;
        }
        
        $contents = null;
        $info     = pathinfo($path);
        if ($info["extension"] == "php") {
            ob_start();
            /** @noinspection PhpIncludeInspection */
            include($path);
            $contents = ob_get_contents();
            ob_end_clean();
        } else {
            $contents = file_get_contents($path);
        }
        
        return $contents;
    }
protected function getFile(WebRequest $request)
    {
        $path = realpath($this->dirRoot . DIRECTORY_SEPARATOR . $request->getPath());
        if (false === $path) {
            throw new Exceptions\HttpStatusError(
                "File not found.",
                404
            );
        }
        if (is_dir($path)) {
            $path .= DIRECTORY_SEPARATOR . $this->index;
        }
        
        $contents = null;
        $info     = pathinfo($path);
        if ($info["extension"] == "php") {
            ob_start();
            /** @noinspection PhpIncludeInspection */
            include($path);
            $contents = ob_get_contents();
            ob_end_clean();
        } else {
            $contents = file_get_contents($path);
        }
        
        return $contents;
    }
protected function getFile ( WebRequest $ request ) { $ path = realpath ( $ this -> dirRoot . DIRECTORY_SEPARATOR . $ request -> getPath ( ) ) ; if ( false === $ path ) { throw new Exceptions \ HttpStatusError ( "File not found." , 404 ) ; } if ( is_dir ( $ path ) ) { $ path .= DIRECTORY_SEPARATOR . $ this -> index ; } $ contents = null ; $ info = pathinfo ( $ path ) ; if ( $ info [ "extension" ] == "php" ) { ob_start ( ) ; /** @noinspection PhpIncludeInspection */ include ( $ path ) ; $ contents = ob_get_contents ( ) ; ob_end_clean ( ) ; } else { $ contents = file_get_contents ( $ path ) ; } return $ contents ; }
Returns the data for the requested file

@param  WebRequest $request The http request
@return string
@throws Exceptions\HttpStatusError
Returns the data for the requested file