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.
Interfaces, Classes, Traits and Enums
- 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() : string
- close() : void
- detach() : mixed
- eof() : bool
- getContents() : string
- getMetadata() : mixed
- {@inheritdoc}
- getSize() : int|null
- isReadable() : bool
- isSeekable() : bool
- isWritable() : bool
- read() : string
- rewind() : void
- seek() : void
- tell() : int
- write() : int
- 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
- $args : array<string|int, mixed>
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
Return values
StreamInterface —__toString()
public
__toString() : string
Return values
string —close()
public
close() : void
Return values
void —detach()
public
detach() : mixed
Return values
mixed —eof()
public
eof() : bool
Return values
bool —getContents()
public
getContents() : string
Return values
string —getMetadata()
{@inheritdoc}
public
getMetadata([mixed $key = null ]) : mixed
Parameters
- $key : mixed = null
Return values
mixed —getSize()
public
getSize() : int|null
Return values
int|null —isReadable()
public
isReadable() : bool
Return values
bool —isSeekable()
public
isSeekable() : bool
Return values
bool —isWritable()
public
isWritable() : bool
Return values
bool —read()
public
read(mixed $length) : string
Parameters
- $length : mixed
Return values
string —rewind()
public
rewind() : void
Return values
void —seek()
public
seek(mixed $offset[, mixed $whence = SEEK_SET ]) : void
Parameters
- $offset : mixed
- $whence : mixed = SEEK_SET
Return values
void —tell()
public
tell() : int
Return values
int —write()
public
write(mixed $string) : int
Parameters
- $string : mixed
Return values
int —createStream()
Creates the underlying stream lazily when required.
protected
createStream() : StreamInterface