ReadLimitEntityBody
extends AbstractEntityBodyDecorator
in package
EntityBody decorator used to return only a subset of an entity body
Table of Contents
- $body : EntityBodyInterface
- $limit : int
- $offset : int
- __call() : mixed
- Allow decorators to implement custom methods
- __construct() : mixed
- __toString() : mixed
- Returns only a subset of the decorated entity body when cast as a string {@inheritdoc}
- close() : mixed
- compress() : bool
- If the stream is readable, compress the data in the stream using deflate compression. The uncompressed stream is then closed, and the compressed stream then becomes the wrapped stream.
- detachStream() : mixed
- feof() : mixed
- Alias of isConsumed() {@inheritdoc}
- ftell() : mixed
- getContentEncoding() : bool|string
- Get the Content-Encoding of the EntityBody
- getContentLength() : int|bool
- Returns the Content-Length of the limited subset of data {@inheritdoc}
- getContentMd5() : bool|string
- Get an MD5 checksum of the stream's contents
- getContentType() : string|null
- Guess the Content-Type of a local stream
- getCustomData() : mixed
- getMetaData() : mixed
- getSize() : mixed
- getStream() : mixed
- getStreamType() : mixed
- getUri() : mixed
- getWrapper() : mixed
- getWrapperData() : mixed
- isConsumed() : mixed
- isLocal() : mixed
- isReadable() : mixed
- isRepeatable() : mixed
- isSeekable() : mixed
- isWritable() : mixed
- read() : mixed
- readLine() : mixed
- rewind() : mixed
- seek() : mixed
- Allow for a bounded seek on the read limited entity body {@inheritdoc}
- setCustomData() : mixed
- setLimit() : self
- Set the limit of bytes that the decorator allows to be read from the stream
- setOffset() : self
- Set the offset to start limiting from
- setRewindFunction() : self
- Specify a custom callback used to rewind a non-seekable stream. This can be useful entity enclosing requests that are redirected.
- setSize() : mixed
- setStream() : mixed
- uncompress() : bool
- Decompress a deflated string. Once uncompressed, the uncompressed string is then used as the wrapped stream.
- write() : mixed
Properties
$body
protected
EntityBodyInterface
$body
Decorated entity body
$limit
protected
int
$limit
Limit the number of bytes that can be read
$offset
protected
int
$offset
Offset to start reading from
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(EntityBodyInterface $body, int $limit, int $offset) : mixed
Parameters
- $body : EntityBodyInterface
-
Body to wrap
- $limit : int
-
Total number of bytes to allow to be read from the stream
- $offset : int
-
Position to seek to before reading (only works on seekable streams)
Return values
mixed —__toString()
Returns only a subset of the decorated entity body when cast as a string {@inheritdoc}
public
__toString() : mixed
Return values
mixed —close()
public
close() : mixed
Return values
mixed —compress()
If the stream is readable, compress the data in the stream using deflate compression. The uncompressed stream is then closed, and the compressed stream then becomes the wrapped stream.
public
compress([mixed $filter = 'zlib.deflate' ]) : bool
Parameters
- $filter : mixed = 'zlib.deflate'
-
Compression filter
Return values
bool —Returns TRUE on success or FALSE on failure
detachStream()
public
detachStream() : mixed
Return values
mixed —feof()
Alias of isConsumed() {@inheritdoc}
public
feof() : mixed
Return values
mixed —ftell()
public
ftell() : mixed
Return values
mixed —getContentEncoding()
Get the Content-Encoding of the EntityBody
public
getContentEncoding() : bool|string
Return values
bool|string —getContentLength()
Returns the Content-Length of the limited subset of data {@inheritdoc}
public
getContentLength() : int|bool
Return values
int|bool —Returns the Content-Length or false on failure
getContentMd5()
Get an MD5 checksum of the stream's contents
public
getContentMd5([mixed $rawOutput = false ][, mixed $base64Encode = false ]) : bool|string
Parameters
- $rawOutput : mixed = false
-
Whether or not to use raw output
- $base64Encode : mixed = false
-
Whether or not to base64 encode raw output (only if raw output is true)
Return values
bool|string —Returns an MD5 string on success or FALSE on failure
getContentType()
Guess the Content-Type of a local stream
public
getContentType() : string|null
Return values
string|null —getCustomData()
public
getCustomData(mixed $key) : mixed
Parameters
- $key : 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 —getStream()
public
getStream() : mixed
Return values
mixed —getStreamType()
public
getStreamType() : mixed
Return values
mixed —getUri()
public
getUri() : mixed
Return values
mixed —getWrapper()
public
getWrapper() : mixed
Return values
mixed —getWrapperData()
public
getWrapperData() : mixed
Return values
mixed —isConsumed()
public
isConsumed() : mixed
Return values
mixed —isLocal()
public
isLocal() : mixed
Return values
mixed —isReadable()
public
isReadable() : mixed
Return values
mixed —isRepeatable()
public
isRepeatable() : 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 —readLine()
public
readLine([mixed $maxLength = null ]) : mixed
Parameters
- $maxLength : mixed = null
Return values
mixed —rewind()
public
rewind() : mixed
Return values
mixed —seek()
Allow for a bounded seek on the read limited entity body {@inheritdoc}
public
seek(mixed $offset[, mixed $whence = SEEK_SET ]) : mixed
Parameters
- $offset : mixed
- $whence : mixed = SEEK_SET
Return values
mixed —setCustomData()
public
setCustomData(mixed $key, mixed $value) : mixed
Parameters
- $key : mixed
- $value : mixed
Return values
mixed —setLimit()
Set the limit of bytes that the decorator allows to be read from the stream
public
setLimit(int $limit) : self
Parameters
- $limit : int
-
Total number of bytes to allow to be read from the stream
Return values
self —setOffset()
Set the offset to start limiting from
public
setOffset(int $offset) : self
Parameters
- $offset : int
-
Offset to seek to and begin byte limiting from
Return values
self —setRewindFunction()
Specify a custom callback used to rewind a non-seekable stream. This can be useful entity enclosing requests that are redirected.
public
setRewindFunction(mixed $callable) : self
Parameters
- $callable : mixed
-
Callable to invoke to rewind a non-seekable stream. The callback must accept an EntityBodyInterface object, perform the rewind if possible, and return a boolean representing whether or not the rewind was successful.
Return values
self —setSize()
public
setSize(mixed $size) : mixed
Parameters
- $size : mixed
Return values
mixed —setStream()
public
setStream(mixed $stream, mixed $size) : mixed
Parameters
- $stream : mixed
- $size : mixed
Return values
mixed —uncompress()
Decompress a deflated string. Once uncompressed, the uncompressed string is then used as the wrapped stream.
public
uncompress([mixed $filter = 'zlib.inflate' ]) : bool
Parameters
- $filter : mixed = 'zlib.inflate'
-
De-compression filter
Return values
bool —Returns TRUE on success or FALSE on failure
write()
public
write(mixed $string) : mixed
Parameters
- $string : mixed