protected static function readFile($path)
    {
        // Workaround for https://github.com/kherge-php/file-manager/pull/2
        $error = null;
        set_error_handler(function ($severity, $message, $filename, $lineno) use (&$error) {
            $error = new \ErrorException($message, 0, $severity, $filename, $lineno);
        }, E_WARNING);

        try {
            $file = new File($path, 'r');
        } finally {
            restore_error_handler();
        }

        if ($error) {
            // @codeCoverageIgnoreStart
            throw new ResourceException(
                "The file \"$path\" could not be opened.",
                $error
            );
            // @codeCoverageIgnoreEnd
        }

        return $file->read();
    }
protected static function readFile($path)
    {
        // Workaround for https://github.com/kherge-php/file-manager/pull/2
        $error = null;
        set_error_handler(function ($severity, $message, $filename, $lineno) use (&$error) {
            $error = new \ErrorException($message, 0, $severity, $filename, $lineno);
        }, E_WARNING);

        try {
            $file = new File($path, 'r');
        } finally {
            restore_error_handler();
        }

        if ($error) {
            // @codeCoverageIgnoreStart
            throw new ResourceException(
                "The file \"$path\" could not be opened.",
                $error
            );
            // @codeCoverageIgnoreEnd
        }

        return $file->read();
    }
protected static function readFile ( $ path ) { // Workaround for https://github.com/kherge-php/file-manager/pull/2 $ error = null ; set_error_handler ( function ( $ severity , $ message , $ filename , $ lineno ) use ( & $ error ) { $ error = new \ ErrorException ( $ message , 0 , $ severity , $ filename , $ lineno ) ; } , E_WARNING ) ; try { $ file = new File ( $ path , 'r' ) ; } finally { restore_error_handler ( ) ; } if ( $ error ) { // @codeCoverageIgnoreStart throw new ResourceException ( "The file \"$path\" could not be opened." , $ error ) ; // @codeCoverageIgnoreEnd } return $ file -> read ( ) ; }
Reads entire file into a string.

@param string $path the file path

@return string the read data

@throws ResourceException
Reads entire file into a string .