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

Public Member Functions

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

Protected Attributes

 $body
 

Detailed Description

Abstract decorator used to wrap entity bodies

Definition at line 10 of file AbstractEntityBodyDecorator.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Http\AbstractEntityBodyDecorator::__construct ( EntityBodyInterface  $body)
Parameters
EntityBodyInterface$bodyEntity body to decorate

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 21 of file AbstractEntityBodyDecorator.php.

References Guzzle\Http\AbstractEntityBodyDecorator\$body.

Member Function Documentation

◆ __call()

Guzzle\Http\AbstractEntityBodyDecorator::__call (   $method,
array  $args 
)

Allow decorators to implement custom methods

Parameters
string$methodMissing method name
array$argsMethod arguments
Returns
mixed

Definition at line 39 of file AbstractEntityBodyDecorator.php.

◆ __toString()

Guzzle\Http\AbstractEntityBodyDecorator::__toString ( )

Convert the stream to a string if the stream is readable and the stream is seekable.

Returns
string

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody, and Guzzle\Http\ReadLimitEntityBody.

Definition at line 26 of file AbstractEntityBodyDecorator.php.

References Guzzle\Http\AbstractEntityBodyDecorator\$body.

◆ close()

Guzzle\Http\AbstractEntityBodyDecorator::close ( )

Close the underlying stream

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 44 of file AbstractEntityBodyDecorator.php.

◆ compress()

Guzzle\Http\AbstractEntityBodyDecorator::compress (   $filter = 'zlib.deflate')

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.

Parameters
string$filterCompression filter
Returns
bool Returns TRUE on success or FALSE on failure

Implements Guzzle\Http\EntityBodyInterface.

Definition at line 61 of file AbstractEntityBodyDecorator.php.

◆ detachStream()

Guzzle\Http\AbstractEntityBodyDecorator::detachStream ( )

Detach the current stream resource

Returns
self

Implements Guzzle\Stream\StreamInterface.

Definition at line 110 of file AbstractEntityBodyDecorator.php.

◆ feof()

Guzzle\Http\AbstractEntityBodyDecorator::feof ( )

Alias of isConsumed() {Alias of isConsumed

Returns
bool
}

Implements Guzzle\Stream\StreamInterface.

Definition at line 166 of file AbstractEntityBodyDecorator.php.

References Guzzle\Http\AbstractEntityBodyDecorator\isConsumed().

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

◆ ftell()

Guzzle\Http\AbstractEntityBodyDecorator::ftell ( )

Returns the current position of the file read/write pointer

Returns
int|bool Returns the position of the file pointer or false on error

Implements Guzzle\Stream\StreamInterface.

Definition at line 208 of file AbstractEntityBodyDecorator.php.

Referenced by Guzzle\Http\CachingEntityBody\__toString(), Guzzle\Http\CachingEntityBody\seek(), and Guzzle\Http\CachingEntityBody\write().

◆ getContentEncoding()

Guzzle\Http\AbstractEntityBodyDecorator::getContentEncoding ( )

Get the Content-Encoding of the EntityBody

Returns
bool|string

Implements Guzzle\Http\EntityBodyInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 88 of file AbstractEntityBodyDecorator.php.

◆ getContentLength()

Guzzle\Http\AbstractEntityBodyDecorator::getContentLength ( )

Get the Content-Length of the entity body if possible (alias of getSize)

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

Implements Guzzle\Http\EntityBodyInterface.

Reimplemented in Guzzle\Http\ReadLimitEntityBody.

Definition at line 71 of file AbstractEntityBodyDecorator.php.

References Guzzle\Http\AbstractEntityBodyDecorator\getSize().

◆ getContentMd5()

Guzzle\Http\AbstractEntityBodyDecorator::getContentMd5 (   $rawOutput = false,
  $base64Encode = false 
)

Get an MD5 checksum of the stream's contents

Parameters
bool$rawOutputWhether or not to use raw output
bool$base64EncodeWhether or not to base64 encode raw output (only if raw output is true)
Returns
bool|string Returns an MD5 string on success or FALSE on failure

Implements Guzzle\Http\EntityBodyInterface.

Definition at line 81 of file AbstractEntityBodyDecorator.php.

References Guzzle\Stream\Stream\getHash().

◆ getContentType()

Guzzle\Http\AbstractEntityBodyDecorator::getContentType ( )

Guess the Content-Type of a local stream

Returns
string|null
See also
http://www.php.net/manual/en/function.finfo-open.php

Implements Guzzle\Http\EntityBodyInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 76 of file AbstractEntityBodyDecorator.php.

◆ getCustomData()

Guzzle\Http\AbstractEntityBodyDecorator::getCustomData (   $key)

Get custom data from the stream

Parameters
string$keyKey to retrieve
Returns
null|mixed

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 213 of file AbstractEntityBodyDecorator.php.

◆ getMetaData()

Guzzle\Http\AbstractEntityBodyDecorator::getMetaData (   $key = null)

Get stream metadata

Parameters
string$keySpecific metadata to retrieve
Returns
array|mixed|null

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 93 of file AbstractEntityBodyDecorator.php.

◆ getSize()

Guzzle\Http\AbstractEntityBodyDecorator::getSize ( )

Get the size of the stream if able

Returns
int|bool

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 137 of file AbstractEntityBodyDecorator.php.

Referenced by Guzzle\Http\AbstractEntityBodyDecorator\getContentLength().

◆ getStream()

Guzzle\Http\AbstractEntityBodyDecorator::getStream ( )

Get the stream resource

Returns
resource

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 98 of file AbstractEntityBodyDecorator.php.

◆ getStreamType()

Guzzle\Http\AbstractEntityBodyDecorator::getStreamType ( )

Get a label describing the underlying implementation of the stream

Returns
string

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 127 of file AbstractEntityBodyDecorator.php.

◆ getUri()

Guzzle\Http\AbstractEntityBodyDecorator::getUri ( )

Get the URI/filename associated with this stream

Returns
string

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 132 of file AbstractEntityBodyDecorator.php.

◆ getWrapper()

Guzzle\Http\AbstractEntityBodyDecorator::getWrapper ( )

Get the stream wrapper type

Returns
string

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 117 of file AbstractEntityBodyDecorator.php.

◆ getWrapperData()

Guzzle\Http\AbstractEntityBodyDecorator::getWrapperData ( )

Wrapper specific data attached to this stream.

Returns
array

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 122 of file AbstractEntityBodyDecorator.php.

◆ isConsumed()

Guzzle\Http\AbstractEntityBodyDecorator::isConsumed ( )

Check if the stream has been consumed

Returns
bool

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody, and Guzzle\Http\ReadLimitEntityBody.

Definition at line 157 of file AbstractEntityBodyDecorator.php.

Referenced by Guzzle\Http\AbstractEntityBodyDecorator\feof().

◆ isLocal()

Guzzle\Http\AbstractEntityBodyDecorator::isLocal ( )

Check if the stream is a local stream vs a remote stream

Returns
bool

Implements Guzzle\Stream\StreamInterface.

Definition at line 171 of file AbstractEntityBodyDecorator.php.

◆ isReadable()

Guzzle\Http\AbstractEntityBodyDecorator::isReadable ( )

Check if the stream is readable

Returns
bool

Implements Guzzle\Stream\StreamInterface.

Definition at line 142 of file AbstractEntityBodyDecorator.php.

Referenced by Guzzle\Http\AbstractEntityBodyDecorator\isRepeatable().

◆ isRepeatable()

Guzzle\Http\AbstractEntityBodyDecorator::isRepeatable ( )

◆ isSeekable()

Guzzle\Http\AbstractEntityBodyDecorator::isSeekable ( )

Check if the string is repeatable

Returns
bool

Implements Guzzle\Stream\StreamInterface.

Definition at line 176 of file AbstractEntityBodyDecorator.php.

Referenced by Guzzle\Http\AbstractEntityBodyDecorator\isRepeatable().

◆ isWritable()

Guzzle\Http\AbstractEntityBodyDecorator::isWritable ( )

Check if the stream is writable

Returns
bool

Implements Guzzle\Stream\StreamInterface.

Definition at line 152 of file AbstractEntityBodyDecorator.php.

◆ read()

Guzzle\Http\AbstractEntityBodyDecorator::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

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\ReadLimitEntityBody, Guzzle\Http\CachingEntityBody, and Guzzle\Http\IoEmittingEntityBody.

Definition at line 193 of file AbstractEntityBodyDecorator.php.

◆ readLine()

Guzzle\Http\AbstractEntityBodyDecorator::readLine (   $maxLength = null)

Read a line from the stream up to the maximum allowed buffer length

Parameters
int$maxLengthMaximum buffer length
Returns
string|bool

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 203 of file AbstractEntityBodyDecorator.php.

◆ rewind()

Guzzle\Http\AbstractEntityBodyDecorator::rewind ( )

Rewind to the beginning of the stream

Returns
bool Returns true on success or false on failure

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 56 of file AbstractEntityBodyDecorator.php.

◆ seek()

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

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

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\ReadLimitEntityBody, and Guzzle\Http\CachingEntityBody.

Definition at line 188 of file AbstractEntityBodyDecorator.php.

◆ setCustomData()

Guzzle\Http\AbstractEntityBodyDecorator::setCustomData (   $key,
  $value 
)

Set custom data on the stream

Parameters
string$keyKey to set
mixed$valueValue to set
Returns
self

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 218 of file AbstractEntityBodyDecorator.php.

◆ setRewindFunction()

Guzzle\Http\AbstractEntityBodyDecorator::setRewindFunction (   $callable)

Specify a custom callback used to rewind a non-seekable stream. This can be useful entity enclosing requests that are redirected.

Parameters
mixed$callableCallable 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.
Returns
self

Implements Guzzle\Http\EntityBodyInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 49 of file AbstractEntityBodyDecorator.php.

◆ setSize()

Guzzle\Http\AbstractEntityBodyDecorator::setSize (   $size)

Specify the size of the stream in bytes

Parameters
int$sizeSize of the stream contents in bytes
Returns
self

Implements Guzzle\Stream\StreamInterface.

Definition at line 181 of file AbstractEntityBodyDecorator.php.

◆ setStream()

Guzzle\Http\AbstractEntityBodyDecorator::setStream (   $stream,
  $size = 0 
)

Set the stream that is wrapped by the object

Parameters
resource$streamStream resource to wrap
int$sizeSize of the stream in bytes. Only pass if the size cannot be obtained from the stream.
Returns
self

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody.

Definition at line 103 of file AbstractEntityBodyDecorator.php.

◆ uncompress()

Guzzle\Http\AbstractEntityBodyDecorator::uncompress (   $filter = 'zlib.inflate')

Decompress a deflated string. Once uncompressed, the uncompressed string is then used as the wrapped stream.

Parameters
string$filterDe-compression filter
Returns
bool Returns TRUE on success or FALSE on failure

Implements Guzzle\Http\EntityBodyInterface.

Definition at line 66 of file AbstractEntityBodyDecorator.php.

◆ write()

Guzzle\Http\AbstractEntityBodyDecorator::write (   $string)

Write data to the stream

Parameters
string$stringThe string that is to be written.
Returns
int|bool Returns the number of bytes written to the stream on success or FALSE on failure.

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\CachingEntityBody, and Guzzle\Http\IoEmittingEntityBody.

Definition at line 198 of file AbstractEntityBodyDecorator.php.

Field Documentation

◆ $body


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