LazyOpenStream
in package
implements
StreamInterface
uses
StreamDecoratorTrait
FinalYes
Lazily reads or writes to a file that is opened only after an IO operation take place on the stream.
Table of Contents
Interfaces
- StreamInterface
- Describes a data stream.
Properties
- $filename : string
- $mode : string
- $stream : StreamInterface
Methods
- __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
- 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
$stream
private
StreamInterface
$stream
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>
__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
__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
stringclose()
public
close() : void
detach()
public
detach() : mixed
eof()
public
eof() : bool
Return values
boolgetContents()
public
getContents() : string
Return values
stringgetMetadata()
public
getMetadata([mixed $key = null ]) : mixed
Parameters
- $key : mixed = 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(mixed $length) : string
Parameters
- $length : mixed
Return values
stringrewind()
public
rewind() : void
seek()
public
seek(mixed $offset[, mixed $whence = SEEK_SET ]) : void
Parameters
- $offset : mixed
- $whence : mixed = SEEK_SET
tell()
public
tell() : int
Return values
intwrite()
public
write(mixed $string) : int
Parameters
- $string : mixed
Return values
intcreateStream()
Creates the underlying stream lazily when required.
protected
createStream() : StreamInterface