Open Journal Systems  3.3.0
Guzzle\Http\ReadLimitEntityBody Class Reference
Inheritance diagram for Guzzle\Http\ReadLimitEntityBody:
Guzzle\Http\AbstractEntityBodyDecorator Guzzle\Http\EntityBodyInterface Guzzle\Stream\StreamInterface

Public Member Functions

 __construct (EntityBodyInterface $body, $limit, $offset=0)
 
 __toString ()
 
 getContentLength ()
 
 isConsumed ()
 
 read ($length)
 
 seek ($offset, $whence=SEEK_SET)
 
 setLimit ($limit)
 
 setOffset ($offset)
 
- Public Member Functions inherited from Guzzle\Http\AbstractEntityBodyDecorator
 __call ($method, array $args)
 
 __construct (EntityBodyInterface $body)
 
 close ()
 
 compress ($filter='zlib.deflate')
 
 detachStream ()
 
 feof ()
 
 ftell ()
 
 getContentEncoding ()
 
 getContentMd5 ($rawOutput=false, $base64Encode=false)
 
 getContentType ()
 
 getCustomData ($key)
 
 getMetaData ($key=null)
 
 getSize ()
 
 getStream ()
 
 getStreamType ()
 
 getUri ()
 
 getWrapper ()
 
 getWrapperData ()
 
 isLocal ()
 
 isReadable ()
 
 isRepeatable ()
 
 isSeekable ()
 
 isWritable ()
 
 readLine ($maxLength=null)
 
 rewind ()
 
 setCustomData ($key, $value)
 
 setRewindFunction ($callable)
 
 setSize ($size)
 
 setStream ($stream, $size=0)
 
 uncompress ($filter='zlib.inflate')
 
 write ($string)
 

Protected Attributes

 $limit
 
 $offset
 
- Protected Attributes inherited from Guzzle\Http\AbstractEntityBodyDecorator
 $body
 

Detailed Description

EntityBody decorator used to return only a subset of an entity body

Definition at line 10 of file ReadLimitEntityBody.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Http\ReadLimitEntityBody::__construct ( EntityBodyInterface  $body,
  $limit,
  $offset = 0 
)
Parameters
EntityBodyInterface$bodyBody to wrap
int$limitTotal number of bytes to allow to be read from the stream
int$offsetPosition to seek to before reading (only works on seekable streams)

Definition at line 29 of file ReadLimitEntityBody.php.

References Guzzle\Http\AbstractEntityBodyDecorator\$body, Guzzle\Http\ReadLimitEntityBody\$limit, Guzzle\Http\ReadLimitEntityBody\$offset, and Guzzle\Http\ReadLimitEntityBody\setLimit().

Member Function Documentation

◆ __toString()

Guzzle\Http\ReadLimitEntityBody::__toString ( )

Returns only a subset of the decorated entity body when cast as a string {Convert the stream to a string if the stream is readable and the stream is seekable.

Returns
string
}

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 39 of file ReadLimitEntityBody.php.

References Guzzle\Http\AbstractEntityBodyDecorator\feof(), and Guzzle\Http\ReadLimitEntityBody\read().

◆ getContentLength()

Guzzle\Http\ReadLimitEntityBody::getContentLength ( )

Returns the Content-Length of the limited subset of data {Get the Content-Length of the entity body if possible (alias of getSize)

Returns
int|bool Returns the Content-Length or false on failure
}

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 68 of file ReadLimitEntityBody.php.

◆ isConsumed()

Guzzle\Http\ReadLimitEntityBody::isConsumed ( )

Check if the stream has been consumed

Returns
bool

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 58 of file ReadLimitEntityBody.php.

References Guzzle\Http\ReadLimitEntityBody\$limit.

◆ read()

Guzzle\Http\ReadLimitEntityBody::read (   $length)

Read data from the stream

Parameters
int$lengthUp to length number of bytes read.
Returns
string|bool Returns the data read from the stream or FALSE on failure or EOF

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 117 of file ReadLimitEntityBody.php.

References Guzzle\Http\ReadLimitEntityBody\$limit.

Referenced by Guzzle\Http\ReadLimitEntityBody\__toString().

◆ seek()

Guzzle\Http\ReadLimitEntityBody::seek (   $offset,
  $whence = SEEK_SET 
)

Allow for a bounded seek on the read limited entity body {Seek to a position in the stream

Parameters
int$offsetStream offset
int$whenceWhere the offset is applied
Returns
bool Returns TRUE on success or FALSE on failure http://www.php.net/manual/en/function.fseek.php
}

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 81 of file ReadLimitEntityBody.php.

References Guzzle\Http\ReadLimitEntityBody\$offset.

◆ setLimit()

Guzzle\Http\ReadLimitEntityBody::setLimit (   $limit)

Set the limit of bytes that the decorator allows to be read from the stream

Parameters
int$limitTotal number of bytes to allow to be read from the stream
Returns
self

Definition at line 110 of file ReadLimitEntityBody.php.

References Guzzle\Http\ReadLimitEntityBody\$limit.

Referenced by Guzzle\Http\ReadLimitEntityBody\__construct().

◆ setOffset()

Guzzle\Http\ReadLimitEntityBody::setOffset (   $offset)

Set the offset to start limiting from

Parameters
int$offsetOffset to seek to and begin byte limiting from
Returns
self

Definition at line 95 of file ReadLimitEntityBody.php.

References Guzzle\Http\ReadLimitEntityBody\$offset.

Field Documentation

◆ $limit

int Guzzle\Http\ReadLimitEntityBody::$limit
protected

◆ $offset

int Guzzle\Http\ReadLimitEntityBody::$offset
protected

The documentation for this class was generated from the following file: