HeaderStream
extends MessagePartStreamDecorator
in package
implements
SplObserver, StreamInterface
Psr7 stream decorator implementation providing a readable stream for a part's headers.
HeaderStream is only used by a MimePart parent. It can accept any MessagePart - for non-MimeParts, only type headers are generated based on available information.
Tags
Interfaces, Classes, Traits and Enums
- SplObserver
- StreamInterface
Table of Contents
- $part : IMessagePart
- $stream : StreamInterface|null
- __call() : mixed
- __construct() : mixed
- __destruct() : mixed
- __get() : StreamInterface
- __toString() : string
- close() : void
- detach() : mixed
- eof() : bool
- getContents() : string
- getMetadata() : mixed
- getSize() : int|null
- isReadable() : bool
- isSeekable() : bool
- isWritable() : bool
- read() : string
- Overridden to wrap exceptions in MessagePartReadException which provides 'getPart' to inspect the part the error occurs on.
- rewind() : void
- seek() : void
- tell() : int
- update() : void
- write() : int
- writePartHeadersTo() : static
- Writes out headers for $this->part and follows them with an empty line.
- createStream() : StreamInterface
- Creates the underlying stream lazily when required.
- resolveStream() : StreamInterface
- Returns the underlying stream, lazily creating it via createStream() if not yet initialized.
- getPartHeadersIterator() : Traversable
- Returns a header array for the current part.
Properties
$part
protected
IMessagePart
$part
the part to read from.
$stream
protected
StreamInterface|null
$stream
= null
Methods
__call()
public
__call(string $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : string
- $args : array<string|int, mixed>
Return values
mixed —__construct()
public
__construct(IMessagePart $part) : mixed
Parameters
- $part : IMessagePart
Return values
mixed —__destruct()
public
__destruct() : mixed
Return values
mixed —__get()
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()
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()
Overridden to wrap exceptions in MessagePartReadException which provides 'getPart' to inspect the part the error occurs on.
public
read(int $length) : string
Parameters
- $length : int
Tags
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 —update()
public
update(SplSubject $subject) : void
Parameters
- $subject : SplSubject
Return values
void —write()
public
write(mixed $string) : int
Parameters
- $string : mixed
Return values
int —writePartHeadersTo()
Writes out headers for $this->part and follows them with an empty line.
public
writePartHeadersTo(StreamInterface $stream) : static
Parameters
- $stream : StreamInterface
Return values
static —createStream()
Creates the underlying stream lazily when required.
protected
createStream() : StreamInterface
Return values
StreamInterface —resolveStream()
Returns the underlying stream, lazily creating it via createStream() if not yet initialized.
protected
resolveStream() : StreamInterface
Return values
StreamInterface —getPartHeadersIterator()
Returns a header array for the current part.
private
getPartHeadersIterator() : Traversable
If the part is not a MimePart, Content-Type, Content-Disposition and Content-Transfer-Encoding headers are generated manually.