class AbstractEntityBodyDecorator

Abstract decorator used to wrap entity bodies

Hierarchy

Expanded class hierarchy of AbstractEntityBodyDecorator

File

drupal/core/vendor/guzzle/http/Guzzle/Http/AbstractEntityBodyDecorator.php, line 10

Namespace

Guzzle\Http
View source
class AbstractEntityBodyDecorator implements EntityBodyInterface {

  /**
   * @var EntityBodyInterface Decorated entity body
   */
  protected $body;

  /**
   * Wrap a entity body
   *
   * @param EntityBodyInterface $body Entity body to decorate
   */
  public function __construct(EntityBodyInterface $body) {
    $this->body = $body;
  }

  /**
   * {@inheritdoc}
   */
  public function __toString() {
    return (string) $this->body;
  }

  /**
   * Allow decorators to implement custom methods
   *
   * @param string $method Missing method name
   * @param array  $args   Method arguments
   *
   * @return mixed
   * @codeCoverageIgnore
   */
  public function __call($method, array $args = null) {
    return call_user_func_array(array(
      $this->body,
      $method,
    ), $args);
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function setRewindFunction($callable) {
    return $this->body
      ->setRewindFunction($callable);
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function rewind() {
    return $this->body
      ->rewind();
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function compress($filter = 'zlib.deflate') {
    return $this->body
      ->compress($filter);
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function uncompress($filter = 'zlib.inflate') {
    return $this->body
      ->uncompress($filter);
  }

  /**
   * {@inheritdoc}
   */
  public function getContentLength() {
    return $this->body
      ->getContentLength();
  }

  /**
   * {@inheritdoc}
   */
  public function getContentType() {
    return $this->body
      ->getContentType();
  }

  /**
   * {@inheritdoc}
   */
  public function getContentMd5($rawOutput = false, $base64Encode = false) {
    $hash = Stream::getHash($this, 'md5', $rawOutput);
    return $hash && $base64Encode ? base64_encode($hash) : $hash;
  }

  /**
   * {@inheritdoc}
   */
  public function getContentEncoding() {
    return $this->body
      ->getContentEncoding();
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function getMetaData($key = null) {
    return $this->body
      ->getMetaData($key);
  }

  /**
   * {@inheritdoc}
   */
  public function getStream() {
    return $this->body
      ->getStream();
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function setStream($stream, $size = 0) {
    return $this->body
      ->setStream($stream, $size);
  }

  /**
   * {@inheritdoc}
   */
  public function getWrapper() {
    return $this->body
      ->getWrapper();
  }

  /**
   * {@inheritdoc}
   */
  public function getWrapperData() {
    return $this->body
      ->getWrapperData();
  }

  /**
   * {@inheritdoc}
   */
  public function getStreamType() {
    return $this->body
      ->getStreamType();
  }

  /**
   * {@inheritdoc}
   */
  public function getUri() {
    return $this->body
      ->getUri();
  }

  /**
   * {@inheritdoc}
   */
  public function getSize() {
    return $this->body
      ->getSize();
  }

  /**
   * {@inheritdoc}
   */
  public function isReadable() {
    return $this->body
      ->isReadable();
  }

  /**
   * {@inheritdoc}
   */
  public function isWritable() {
    return $this->body
      ->isWritable();
  }

  /**
   * {@inheritdoc}
   */
  public function isConsumed() {
    return $this->body
      ->isConsumed();
  }

  /**
   * {@inheritdoc}
   */
  public function isLocal() {
    return $this->body
      ->isLocal();
  }

  /**
   * {@inheritdoc}
   */
  public function isSeekable() {
    return $this->body
      ->isSeekable();
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function setSize($size) {
    return $this->body
      ->setSize($size);
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function seek($offset, $whence = SEEK_SET) {
    return $this->body
      ->seek($offset, $whence);
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function read($length) {
    return $this->body
      ->read($length);
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function write($string) {
    return $this->body
      ->write($string);
  }

  /**
   * {@inheritdoc}
   * @codeCoverageIgnore
   */
  public function ftell() {
    return $this->body
      ->ftell();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractEntityBodyDecorator::$body protected property
AbstractEntityBodyDecorator::compress public function @codeCoverageIgnore Overrides EntityBodyInterface::compress
AbstractEntityBodyDecorator::ftell public function @codeCoverageIgnore Overrides StreamInterface::ftell
AbstractEntityBodyDecorator::getContentEncoding public function Get the Content-Encoding of the EntityBody Overrides EntityBodyInterface::getContentEncoding
AbstractEntityBodyDecorator::getContentLength public function Get the Content-Length of the entity body if possible (alias of getSize) Overrides EntityBodyInterface::getContentLength 1
AbstractEntityBodyDecorator::getContentMd5 public function Get an MD5 checksum of the stream's contents Overrides EntityBodyInterface::getContentMd5
AbstractEntityBodyDecorator::getContentType public function Guess the Content-Type or return the default application/octet-stream Overrides EntityBodyInterface::getContentType
AbstractEntityBodyDecorator::getMetaData public function @codeCoverageIgnore Overrides StreamInterface::getMetaData
AbstractEntityBodyDecorator::getSize public function Get the size of the stream if able Overrides StreamInterface::getSize
AbstractEntityBodyDecorator::getStream public function Get the stream resource Overrides StreamInterface::getStream
AbstractEntityBodyDecorator::getStreamType public function Get a label describing the underlying implementation of the stream Overrides StreamInterface::getStreamType
AbstractEntityBodyDecorator::getUri public function Get the URI/filename associated with this stream Overrides StreamInterface::getUri
AbstractEntityBodyDecorator::getWrapper public function Get the stream wrapper type Overrides StreamInterface::getWrapper
AbstractEntityBodyDecorator::getWrapperData public function Wrapper specific data attached to this stream. Overrides StreamInterface::getWrapperData
AbstractEntityBodyDecorator::isConsumed public function Check if the stream has been consumed Overrides StreamInterface::isConsumed 1
AbstractEntityBodyDecorator::isLocal public function Check if the stream is a local stream vs a remote stream Overrides StreamInterface::isLocal
AbstractEntityBodyDecorator::isReadable public function Check if the stream is readable Overrides StreamInterface::isReadable
AbstractEntityBodyDecorator::isSeekable public function Check if the string is repeatable Overrides StreamInterface::isSeekable
AbstractEntityBodyDecorator::isWritable public function Check if the stream is writable Overrides StreamInterface::isWritable
AbstractEntityBodyDecorator::read public function @codeCoverageIgnore Overrides StreamInterface::read 2
AbstractEntityBodyDecorator::rewind public function @codeCoverageIgnore Overrides StreamInterface::rewind
AbstractEntityBodyDecorator::seek public function @codeCoverageIgnore Overrides StreamInterface::seek 1
AbstractEntityBodyDecorator::setRewindFunction public function @codeCoverageIgnore Overrides EntityBodyInterface::setRewindFunction
AbstractEntityBodyDecorator::setSize public function @codeCoverageIgnore Overrides StreamInterface::setSize
AbstractEntityBodyDecorator::setStream public function @codeCoverageIgnore Overrides StreamInterface::setStream
AbstractEntityBodyDecorator::uncompress public function @codeCoverageIgnore Overrides EntityBodyInterface::uncompress
AbstractEntityBodyDecorator::write public function @codeCoverageIgnore Overrides StreamInterface::write 1
AbstractEntityBodyDecorator::__call public function Allow decorators to implement custom methods
AbstractEntityBodyDecorator::__construct public function Wrap a entity body 1
AbstractEntityBodyDecorator::__toString public function Convert the stream to a string if the stream is readable and the stream is seekable. Overrides StreamInterface::__toString 1