Class EntityBody
Entity body used with an HTTP request or response
- Guzzle\Stream\Stream implements Guzzle\Stream\StreamInterface
- Guzzle\Http\EntityBody implements Guzzle\Http\EntityBodyInterface
Methods summary
-
public static
factory ( resource|string|EntityBody $resource = '', int $size = null )
Create a new EntityBody based on the input type
-
public
setRewindFunction ( mixed $callable )
Specify a custom callback used to rewind a non-seekable stream. This can be useful entity enclosing requests that are redirected.
-
public
rewind ( )
Rewind to the beginning of the stream
-
public static
fromString ( string $string )
Create a new EntityBody from a string
-
public
compress ( string $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.
-
public
uncompress ( string $filter = 'zlib.inflate' )
Decompress a deflated string. Once uncompressed, the uncompressed string is then used as the wrapped stream.
-
public
getContentLength ( )
Get the Content-Length of the entity body if possible (alias of getSize)
-
public
getContentType ( )
Guess the Content-Type of a local stream
-
public
getContentMd5 ( bool $rawOutput = false, bool $base64Encode = false )
Get an MD5 checksum of the stream's contents
-
public
setStreamFilterContentEncoding ( mixed $streamFilterContentEncoding )
-
public
getContentEncoding ( )
Get the Content-Encoding of the EntityBody
-
protected
handleCompression ( mixed $filter, mixed $offsetStart = 0 )
Methods detail
public static
Guzzle\Http\EntityBody
factory( resource|string|Guzzle\Http\EntityBody
$resource = '', integer $size = null )
Create a new EntityBody based on the input type
Parameters
- $resource
resource|string|
Guzzle\Http\EntityBody
$resource Entity body data- $size
integer
$size Size of the data contained in the resource
Returns
Throws
Specify a custom callback used to rewind a non-seekable stream. This can be useful entity enclosing requests that are redirected.
Parameters
- $callable
mixed
$callable 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.
Returns
Implementation of
Rewind to the beginning of the stream
Returns
boolean
Returns true on success or false on failure
Overrides
Implementation of
Create a new EntityBody from a string
Parameters
- $string
string
$string String of data
Returns
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
- $filter
string
$filter Compression filter
Returns
boolean
Returns TRUE on success or FALSE on failure
Implementation of
Decompress a deflated string. Once uncompressed, the uncompressed string is then used as the wrapped stream.
Parameters
- $filter
string
$filter De-compression filter
Returns
boolean
Returns TRUE on success or FALSE on failure
Implementation of
Get the Content-Length of the entity body if possible (alias of getSize)
Returns
integer|boolean
Returns the Content-Length or false on failure
Implementation of
Guess the Content-Type of a local stream
Returns
string|null
See
Implementation of
Get an MD5 checksum of the stream's contents
Parameters
- $rawOutput
boolean
$rawOutput Whether or not to use raw output- $base64Encode
boolean
$base64Encode Whether or not to base64 encode raw output (only if raw output is true)
Returns
boolean|string
Returns an MD5 string on success or FALSE on failure
Implementation of
Get the Content-Encoding of the EntityBody
Returns
boolean|string
Implementation of
Methods inherited from Guzzle\Stream\Stream
__construct()
,
__destruct()
,
__toString()
,
close()
,
detachStream()
,
feof()
,
ftell()
,
getCustomData()
,
getHash()
,
getMetaData()
,
getSize()
,
getStream()
,
getStreamType()
,
getUri()
,
getWrapper()
,
getWrapperData()
,
isConsumed()
,
isLocal()
,
isReadable()
,
isRepeatable()
,
isSeekable()
,
isWritable()
,
read()
,
readLine()
,
rebuildCache()
,
seek()
,
setCustomData()
,
setSize()
,
setStream()
,
write()
Magic methods summary
Constants summary
Constants inherited from Guzzle\Stream\Stream
IS_LOCAL
,
IS_READABLE
,
IS_WRITABLE
,
SEEKABLE
,
STREAM_TYPE
,
WRAPPER_TYPE
Properties summary
protected
boolean
|
$contentEncoding |
#
Content-Encoding of the entity body if known |
protected
callable
|
$rewindFunction |
#
Method to invoke for rewinding a stream |