protected static function get_file_handle_for_path($path, $type = stored_file::FILE_HANDLE_FOPEN) {
        switch ($type) {
            case stored_file::FILE_HANDLE_FOPEN:
                // Binary reading.
                return fopen($path, 'rb');
            case stored_file::FILE_HANDLE_GZOPEN:
                // Binary reading of file in gz format.
                return gzopen($path, 'rb');
            default:
                throw new coding_exception('Unexpected file handle type');
        }
    }
protected static function get_file_handle_for_path($path, $type = stored_file::FILE_HANDLE_FOPEN) {
        switch ($type) {
            case stored_file::FILE_HANDLE_FOPEN:
                // Binary reading.
                return fopen($path, 'rb');
            case stored_file::FILE_HANDLE_GZOPEN:
                // Binary reading of file in gz format.
                return gzopen($path, 'rb');
            default:
                throw new coding_exception('Unexpected file handle type');
        }
    }
protected static function get_file_handle_for_path ( $ path , $ type = stored_file :: FILE_HANDLE_FOPEN ) { switch ( $ type ) { case stored_file :: FILE_HANDLE_FOPEN : // Binary reading. return fopen ( $ path , 'rb' ) ; case stored_file :: FILE_HANDLE_GZOPEN : // Binary reading of file in gz format. return gzopen ( $ path , 'rb' ) ; default : throw new coding_exception ( 'Unexpected file handle type' ) ; } }
Return a file handle for the specified path.

This abstraction should be used when overriding get_content_file_handle in a new file system.

@param string $path The path to the file. This shoudl be any type of path that fopen and gzopen accept.
@param int $type Type of file handle (FILE_HANDLE_xx constant)
@return resource
@throws coding_exception When an unexpected type of file handle is requested
Return a file handle for the specified path .