Documentation

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

$override  : array<string, Closure>
$stream  : StreamInterface

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 = []

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

__toString()

public __toString() : string
Return values
string

dummyOverrideAll()

Sets the override methods

public dummyOverrideAll(array<string, Closure$methods) : static
Parameters
$methods : array<string, Closure>
Return values
static

dummyOverrideMethod()

Sets a single override method

public dummyOverrideMethod(string $name, Closure $fn) : static
Parameters
$name : string
$fn : Closure
Return values
static

dummySetStream()

Sets a StreamInterface to override

public dummySetStream(StreamInterface $stream) : static
Parameters
$stream : StreamInterface
Return values
static

getContents()

public getContents() : string
Return values
string

getMetadata()

public getMetadata([string|null $key = null ]) : mixed
Parameters
$key : string|null = null

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(int $length) : string
Parameters
$length : int
Return values
string

seek()

public seek(int $offset[, int $whence = SEEK_SET ]) : void
Parameters
$offset : int
$whence : int = SEEK_SET

write()

public write(string $string) : int
Parameters
$string : string
Return values
int

        
On this page

Search results