Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

File Size: 171 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

AbstractReader:: (8 methods):
  open()
  close()
  ensureStreamOpened()
  getFileRealPath()
  getStreamWrapperScheme()
  isStreamWrapper()
  isSupportedStreamWrapper()
  isPhpStream()


Class: AbstractReader  - X-Ref


open(string $filePath)   X-Ref
Prepares the reader to read the given file. It also makes sure
that the file exists and is readable.

param: string $filePath Path of the file to be read

close()   X-Ref
Closes the reader, preventing any additional reading.


ensureStreamOpened()   X-Ref
Closes the reader. To be used after reading the file.


getFileRealPath(string $filePath)   X-Ref
Returns the real path of the given path.
If the given path is a valid stream wrapper, returns the path unchanged.


getStreamWrapperScheme(string $filePath)   X-Ref
Returns the scheme of the custom stream wrapper, if the path indicates a stream wrapper is used.
For example, php://temp => php, s3://path/to/file => s3...

param: string $filePath Path of the file to be read
return: null|string The stream wrapper scheme or NULL if not a stream wrapper

isStreamWrapper(string $filePath)   X-Ref
Checks if the given path is an unsupported stream wrapper
(like local path, php://temp, mystream://foo/bar...).

param: string $filePath Path of the file to be read
return: bool Whether the given path is an unsupported stream wrapper

isSupportedStreamWrapper(string $filePath)   X-Ref
Checks if the given path is an supported stream wrapper
(like php://temp, mystream://foo/bar...).
If the given path is a local path, returns true.

param: string $filePath Path of the file to be read
return: bool Whether the given path is an supported stream wrapper

isPhpStream(string $filePath)   X-Ref
Checks if a path is a PHP stream (like php://output, php://memory, ...).

param: string $filePath Path of the file to be read
return: bool Whether the given path maps to a PHP stream