LazyOpenStream
in package
implements
StreamInterface
Uses
StreamDecoratorTrait
Lazily reads or writes to a file that is opened only after an IO operation take place on the stream.
Tags
Interfaces, Classes and Traits
- StreamInterface
- Describes a data stream.
Table of Contents
- $filename : string
- $mode : string
- __call() : mixed
- Allow decorators to implement custom methods
- __construct() : mixed
- __get() : StreamInterface
- Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).
- __toString() : mixed
- close() : mixed
- detach() : mixed
- eof() : mixed
- getContents() : mixed
- getMetadata() : mixed
- getSize() : mixed
- isReadable() : mixed
- isSeekable() : mixed
- isWritable() : mixed
- read() : mixed
- rewind() : mixed
- seek() : mixed
- tell() : mixed
- write() : mixed
- createStream() : StreamInterface
- Creates the underlying stream lazily when required.
Properties
$filename
private
string
$filename
$mode
private
string
$mode
Methods
__call()
Allow decorators to implement custom methods
public
__call(string $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : string
-
Missing method name
- $args : array<string|int, mixed>
-
Method arguments
Return values
mixed —__construct()
public
__construct(string $filename, string $mode) : mixed
Parameters
- $filename : string
-
File to lazily open
- $mode : string
-
fopen mode to use when opening the stream
Return values
mixed —__get()
Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).
public
__get(string $name) : StreamInterface
Parameters
- $name : string
-
Name of the property (allows "stream" only).
Return values
StreamInterface —__toString()
public
__toString() : mixed
Return values
mixed —close()
public
close() : mixed
Return values
mixed —detach()
public
detach() : mixed
Return values
mixed —eof()
public
eof() : mixed
Return values
mixed —getContents()
public
getContents() : mixed
Return values
mixed —getMetadata()
public
getMetadata([mixed $key = null ]) : mixed
Parameters
- $key : mixed = null
Return values
mixed —getSize()
public
getSize() : mixed
Return values
mixed —isReadable()
public
isReadable() : mixed
Return values
mixed —isSeekable()
public
isSeekable() : mixed
Return values
mixed —isWritable()
public
isWritable() : mixed
Return values
mixed —read()
public
read(mixed $length) : mixed
Parameters
- $length : mixed
Return values
mixed —rewind()
public
rewind() : mixed
Return values
mixed —seek()
public
seek(mixed $offset[, mixed $whence = SEEK_SET ]) : mixed
Parameters
- $offset : mixed
- $whence : mixed = SEEK_SET
Return values
mixed —tell()
public
tell() : mixed
Return values
mixed —write()
public
write(mixed $string) : mixed
Parameters
- $string : mixed
Return values
mixed —createStream()
Creates the underlying stream lazily when required.
protected
createStream() : StreamInterface