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

Public Member Functions

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

Static Public Member Functions

static calculateMd5 (EntityBodyInterface $body, $rawOutput=false, $base64Encode=false)
 
static factory ($resource='', $size=null)
 
static fromString ($string)
 
- Static Public Member Functions inherited from Guzzle\Stream\Stream
static getHash (StreamInterface $stream, $algo, $rawOutput=false)
 

Protected Member Functions

 handleCompression ($filter, $offsetStart=0)
 
- Protected Member Functions inherited from Guzzle\Stream\Stream
 rebuildCache ()
 

Protected Attributes

 $contentEncoding = false
 
 $rewindFunction
 
- Protected Attributes inherited from Guzzle\Stream\Stream
 $cache = array()
 
 $customData = array()
 
 $size
 
 $stream
 

Additional Inherited Members

- Data Fields inherited from Guzzle\Stream\Stream
const IS_LOCAL = 'is_local'
 
const IS_READABLE = 'is_readable'
 
const IS_WRITABLE = 'is_writable'
 
const SEEKABLE = 'seekable'
 
const STREAM_TYPE = 'stream_type'
 
const WRAPPER_TYPE = 'wrapper_type'
 
- Static Protected Attributes inherited from Guzzle\Stream\Stream
static $readWriteHash
 

Detailed Description

Entity body used with an HTTP request or response

Definition at line 13 of file EntityBody.php.

Member Function Documentation

◆ calculateMd5()

static Guzzle\Http\EntityBody::calculateMd5 ( EntityBodyInterface  $body,
  $rawOutput = false,
  $base64Encode = false 
)
static

Calculate the MD5 hash of an entity body

Parameters
EntityBodyInterface$bodyEntity body to calculate the hash for
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
Deprecated:
This will be deprecated soon @codeCoverageIgnore

Definition at line 153 of file EntityBody.php.

References Guzzle\Http\EntityBodyInterface\getContentMd5(), and Guzzle\Common\Version\warn().

◆ compress()

Guzzle\Http\EntityBody::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 93 of file EntityBody.php.

References Guzzle\Http\EntityBody\handleCompression().

◆ factory()

static Guzzle\Http\EntityBody::factory (   $resource = '',
  $size = null 
)
static

Create a new EntityBody based on the input type

Parameters
resource | string | EntityBody$resourceEntity body data
int$sizeSize of the data contained in the resource
Returns
EntityBody
Exceptions
InvalidArgumentExceptionif the $resource arg is not a resource or string

Definition at line 36 of file EntityBody.php.

References Guzzle\Stream\Stream\$size, and Guzzle\Http\EntityBody\fromString().

Referenced by Guzzle\Http\Message\Response\__construct(), Guzzle\Tests\Http\Curl\CurlHandleTest\dataProvider(), Guzzle\Http\Message\Request\getResponseBody(), Guzzle\Plugin\Log\LogPlugin\onRequestBeforeSend(), Guzzle\Http\Curl\RequestMediator\receiveResponseHeader(), Guzzle\Http\Message\EntityEnclosingRequest\setBody(), Guzzle\Http\Message\Response\setBody(), Guzzle\Http\Message\Request\setResponseBody(), Guzzle\Tests\Http\IoEmittingEntityBodyTest\setUp(), Guzzle\Tests\Log\MessageFormatterTest\setUp(), Guzzle\Tests\Http\CachingEntityBodyTest\setUp(), Guzzle\Tests\Http\ReadLimitEntityBodyTest\setUp(), Guzzle\Tests\Service\Command\LocationVisitor\Request\BodyVisitorTest\testAddsContentEncodingWhenSetOnBody(), Guzzle\Tests\Http\EntityBodyTest\testAllowsCustomRewind(), Guzzle\Tests\Service\Command\CommandTest\testCanChangeResponseBody(), Guzzle\Tests\Http\Message\HttpRequestFactoryTest\testCanChangeSaveToLocation(), Guzzle\Tests\Http\CachingEntityBodyTest\testClosesBothStreams(), Guzzle\Tests\Message\ResponseTest\testConstructor(), Guzzle\Tests\Http\EntityBodyTest\testCreatesMd5Checksum(), Guzzle\Tests\Http\Message\HttpRequestFactoryTest\testCreatesNewGetRequests(), Guzzle\Tests\Http\Message\HttpRequestFactoryTest\testCreatesPutRequests(), Guzzle\Tests\Http\EntityBodyTest\testCustomRewindFunctionMustBeCallable(), Guzzle\Tests\Http\AbstractEntityBodyDecoratorTest\testDecoratesEntityBody(), Guzzle\Tests\Http\EntityBodyTest\testDeterminesContentType(), Guzzle\Tests\Message\ResponseTest\testDeterminesIfItCanBeCached(), Guzzle\Tests\Http\EntityBodyTest\testFactory(), Guzzle\Tests\Http\EntityBodyTest\testFactoryCanCreateFromObject(), Guzzle\Tests\Http\EntityBodyTest\testFactoryCreatesTempStreamByDefault(), Guzzle\Tests\Http\EntityBodyTest\testFactoryEnsuresObjectsHaveToStringMethod(), Guzzle\Tests\Http\EntityBodyTest\testFactoryThrowsException(), Guzzle\Tests\Message\ResponseTest\testGetBody(), Guzzle\Tests\Http\EntityBodyTest\testGetTypeFormBodyFactoring(), Guzzle\Tests\Http\EntityBodyTest\testHandlesCompression(), Guzzle\Tests\Plugin\Md5\Md5ValidatorPluginTest\testProperlyValidatesWhenUsingContentEncoding(), Guzzle\Tests\Plugin\Mock\MockPluginTest\testReadsBodiesFromMockedRequests(), Guzzle\Tests\Http\Message\EntityEnclosingRequestTest\testRequestBodyAddsContentLength(), Guzzle\Tests\Http\Message\RequestTest\testRequestCanHaveManuallySetResponseBody(), Guzzle\Tests\Http\Message\EntityEnclosingRequestTest\testRequestHasMutableBody(), Guzzle\Tests\Http\ReadLimitEntityBodyTest\testReturnsSubsetOfEmptyBodyWhenCastToString(), Guzzle\Tests\Http\ReadLimitEntityBodyTest\testReturnsSubsetWhenCastToString(), Guzzle\Tests\Plugin\Redirect\RedirectPluginTest\testRewindsStreamWhenRedirectingIfNeeded(), Guzzle\Tests\Http\CachingEntityBodyTest\testRewindUsesSeek(), Guzzle\Tests\Http\EntityBodyTest\testSeeksToOriginalPosAfterMd5(), Guzzle\Tests\Http\Message\EntityEnclosingRequestTest\testSetsContentTypeWhenSettingBodyByGuessingFromEntityBody(), Guzzle\Tests\Http\CachingEntityBodyTest\testSkipsOverwrittenBytes(), Guzzle\Tests\Plugin\Redirect\RedirectPluginTest\testThrowsExceptionWhenStreamCannotBeRewound(), Guzzle\Tests\Http\Curl\CurlHandleTest\testUploadsPutData(), Guzzle\Tests\Http\Curl\CurlHandleTest\testUploadsPutDataUsingChunkedEncodingWhenLengthCannotBeDetermined(), Guzzle\Tests\Http\Message\RequestTest\testUsesCustomResponseBodyWhenItIsCustom(), Guzzle\Tests\Http\CachingEntityBodyTest\testUsesRemoteSizeIfPossible(), Guzzle\Tests\Plugin\Log\LogPluginTest\testWiresBodiesWhenNeeded(), and Guzzle\Service\Command\LocationVisitor\Request\BodyVisitor\visit().

◆ fromString()

static Guzzle\Http\EntityBody::fromString (   $string)
static

Create a new EntityBody from a string

Parameters
string$stringString of data
Returns
EntityBody

Definition at line 82 of file EntityBody.php.

References Guzzle\Stream\Stream\$stream, and Guzzle\Http\EntityBody\rewind().

Referenced by Guzzle\Http\EntityBody\factory().

◆ getContentEncoding()

Guzzle\Http\EntityBody::getContentEncoding ( )

Get the Content-Encoding of the EntityBody

Returns
bool|string

Implements Guzzle\Http\EntityBodyInterface.

Definition at line 166 of file EntityBody.php.

◆ getContentLength()

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

Definition at line 123 of file EntityBody.php.

References Guzzle\Stream\Stream\getSize().

◆ getContentMd5()

Guzzle\Http\EntityBody::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 133 of file EntityBody.php.

◆ getContentType()

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

Definition at line 128 of file EntityBody.php.

References Guzzle\Http\Mimetypes\getInstance(), and Guzzle\Stream\Stream\getUri().

◆ handleCompression()

Guzzle\Http\EntityBody::handleCompression (   $filter,
  $offsetStart = 0 
)
protected

◆ rewind()

Guzzle\Http\EntityBody::rewind ( )

Rewind to the beginning of the stream

Returns
bool Returns true on success or false on failure

Reimplemented from Guzzle\Stream\Stream.

Definition at line 70 of file EntityBody.php.

Referenced by Guzzle\Http\EntityBody\fromString().

◆ setRewindFunction()

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

Definition at line 59 of file EntityBody.php.

◆ setStreamFilterContentEncoding()

Guzzle\Http\EntityBody::setStreamFilterContentEncoding (   $streamFilterContentEncoding)

Definition at line 159 of file EntityBody.php.

◆ uncompress()

Guzzle\Http\EntityBody::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 101 of file EntityBody.php.

References Guzzle\Http\EntityBody\handleCompression(), Guzzle\Stream\Stream\isConsumed(), Guzzle\Stream\Stream\isReadable(), and Guzzle\Stream\Stream\isSeekable().

Field Documentation

◆ $contentEncoding

bool Guzzle\Http\EntityBody::$contentEncoding = false
protected

Content-Encoding of the entity body if known

Definition at line 19 of file EntityBody.php.

◆ $rewindFunction

callable Guzzle\Http\EntityBody::$rewindFunction
protected

Method to invoke for rewinding a stream

Definition at line 25 of file EntityBody.php.


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