private function readFile($filename)
    {
        if (!file_exists($filename)) {
            throw new \Exception(sprintf('File not found: %s', $filename));
        }
        if (!is_readable($filename) || ($content = file_get_contents($filename)) === false) {
            throw new \Exception(sprintf('Failed to read file: %s', $filename));
        }

        return $content;
    }
private function readFile($filename)
    {
        if (!file_exists($filename)) {
            throw new \Exception(sprintf('File not found: %s', $filename));
        }
        if (!is_readable($filename) || ($content = file_get_contents($filename)) === false) {
            throw new \Exception(sprintf('Failed to read file: %s', $filename));
        }

        return $content;
    }
private function readFile ( $ filename ) { if ( ! file_exists ( $ filename ) ) { throw new \ Exception ( sprintf ( 'File not found: %s' , $ filename ) ) ; } if ( ! is_readable ( $ filename ) || ( $ content = file_get_contents ( $ filename ) ) === false ) { throw new \ Exception ( sprintf ( 'Failed to read file: %s' , $ filename ) ) ; } return $ content ; }
Reads a file and throws appropriate exceptions on failure.

@param string $filename

@throws \Exception if the file cannot be found or read.

@return string
Reads a file and throws appropriate exceptions on failure .