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: 180 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

FnStream:: (20 methods):
  __construct()
  __get()
  __destruct()
  __wakeup()
  decorate()
  __toString()
  close()
  detach()
  getSize()
  tell()
  eof()
  isSeekable()
  rewind()
  seek()
  isWritable()
  write()
  isReadable()
  read()
  getContents()
  getMetadata()


Class: FnStream  - X-Ref

Compose stream implementations based on a hash of functions.

Allows for easy testing and extension of a provided stream without needing
to create a concrete class for a simple extension point.
__construct(array $methods)   X-Ref

param: array<string, callable> $methods Hash of method name to a callable.

__get(string $name)   X-Ref
Lazily determine which methods are not implemented.


__destruct()   X-Ref
The close method is called on the underlying stream only if possible.


__wakeup()   X-Ref
An unserialize would allow the __destruct to run when the unserialized value goes out of scope.


decorate(StreamInterface $stream, array $methods)   X-Ref
Adds custom functionality to an underlying stream by intercepting
specific method calls.

param: StreamInterface         $stream  Stream to decorate
param: array<string, callable> $methods Hash of method name to a closure
return: FnStream

__toString()   X-Ref
No description

close()   X-Ref
No description

detach()   X-Ref
No description

getSize()   X-Ref
No description

tell()   X-Ref
No description

eof()   X-Ref
No description

isSeekable()   X-Ref
No description

rewind()   X-Ref
No description

seek($offset, $whence = SEEK_SET)   X-Ref
No description

isWritable()   X-Ref
No description

write($string)   X-Ref
No description

isReadable()   X-Ref
No description

read($length)   X-Ref
No description

getContents()   X-Ref
No description

getMetadata($key = null)   X-Ref
{@inheritdoc}

return: mixed