DummyStream
in package
implements
StreamInterface
A stream handler that allows to override select methods of the given StreamInterface
Table of Contents
Interfaces
- StreamInterface
Constants
- STREAMINTERFACE_METHODS = ['__toString', 'close', 'detach', 'rewind', 'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write', 'isReadable', 'read', 'getContents', 'getMetadata']
Properties
Methods
- __construct() : mixed
- DummyStream constructor
- __destruct() : mixed
- __toString() : string
- close() : void
- detach() : mixed
- dummyOverrideAll() : static
- Sets the override methods
- dummyOverrideMethod() : static
- Sets a single override method
- dummySetStream() : static
- Sets a StreamInterface to override
- eof() : bool
- getContents() : string
- getMetadata() : mixed
- getSize() : int|null
- isReadable() : bool
- isSeekable() : bool
- isWritable() : bool
- read() : string
- rewind() : void
- seek() : void
- tell() : int
- write() : int
Constants
STREAMINTERFACE_METHODS
protected
mixed
STREAMINTERFACE_METHODS
= ['__toString', 'close', 'detach', 'rewind', 'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write', 'isReadable', 'read', 'getContents', 'getMetadata']
Properties
$override
protected
array<string, Closure>
$override
= []
$stream
protected
StreamInterface
$stream
Methods
__construct()
DummyStream constructor
public
__construct([StreamInterface|null $stream = null ][, array<string, Closure>|null $methods = null ]) : mixed
Parameters
- $stream : StreamInterface|null = null
- $methods : array<string, Closure>|null = null
__destruct()
public
__destruct() : mixed
__toString()
public
__toString() : string
Return values
stringclose()
public
close() : void
detach()
public
detach() : mixed
dummyOverrideAll()
Sets the override methods
public
dummyOverrideAll(array<string, Closure> $methods) : static
Parameters
- $methods : array<string, Closure>
Return values
staticdummyOverrideMethod()
Sets a single override method
public
dummyOverrideMethod(string $name, Closure $fn) : static
Parameters
- $name : string
- $fn : Closure
Return values
staticdummySetStream()
Sets a StreamInterface to override
public
dummySetStream(StreamInterface $stream) : static
Parameters
- $stream : StreamInterface
Return values
staticeof()
public
eof() : bool
Return values
boolgetContents()
public
getContents() : string
Return values
stringgetMetadata()
public
getMetadata([string|null $key = null ]) : mixed
Parameters
- $key : string|null = null
getSize()
public
getSize() : int|null
Return values
int|nullisReadable()
public
isReadable() : bool
Return values
boolisSeekable()
public
isSeekable() : bool
Return values
boolisWritable()
public
isWritable() : bool
Return values
boolread()
public
read(int $length) : string
Parameters
- $length : int
Return values
stringrewind()
public
rewind() : void
seek()
public
seek(int $offset[, int $whence = SEEK_SET ]) : void
Parameters
- $offset : int
- $whence : int = SEEK_SET
tell()
public
tell() : int
Return values
intwrite()
public
write(string $string) : int
Parameters
- $string : string