Overview
  • Namespace
  • Class

Namespaces

  • Http
    • Message
      • Authentication
      • Decorator
      • Encoding
        • Filter
      • Formatter
      • MessageFactory
      • StreamFactory
      • UriFactory

Classes

  • Http\Message\Authentication\BasicAuth
  • Http\Message\Authentication\Bearer
  • Http\Message\Authentication\Chain
  • Http\Message\Authentication\Matching
  • Http\Message\Authentication\QueryParam
  • Http\Message\Authentication\Wsse
  • Http\Message\Encoding\ChunkStream
  • Http\Message\Encoding\CompressStream
  • Http\Message\Encoding\DechunkStream
  • Http\Message\Encoding\DecompressStream
  • Http\Message\Encoding\DeflateStream
  • Http\Message\Encoding\Filter\Chunk
  • Http\Message\Encoding\FilteredStream
  • Http\Message\Encoding\GzipDecodeStream
  • Http\Message\Encoding\GzipEncodeStream
  • Http\Message\Encoding\InflateStream
  • Http\Message\Formatter\SimpleFormatter
  • Http\Message\MessageFactory\DiactorosMessageFactory
  • Http\Message\MessageFactory\GuzzleMessageFactory
  • Http\Message\StreamFactory\DiactorosStreamFactory
  • Http\Message\StreamFactory\GuzzleStreamFactory
  • Http\Message\UriFactory\DiactorosUriFactory
  • Http\Message\UriFactory\GuzzleUriFactory

Interfaces

  • Http\Message\Authentication
  • Http\Message\Formatter

Traits

  • Http\Message\Decorator\MessageDecorator
  • Http\Message\Decorator\RequestDecorator
  • Http\Message\Decorator\ResponseDecorator
  • Http\Message\Decorator\StreamDecorator
  1 <?php
  2 
  3 namespace Http\Message\Decorator;
  4 
  5 use Psr\Http\Message\MessageInterface;
  6 use Psr\Http\Message\StreamInterface;
  7 
  8 /**
  9  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
 10  */
 11 trait MessageDecorator
 12 {
 13     /**
 14      * @var MessageInterface
 15      */
 16     private $message;
 17 
 18     /**
 19      * Returns the decorated message.
 20      *
 21      * Since the underlying Message is immutable as well
 22      * exposing it is not an issue, because it's state cannot be altered
 23      *
 24      * @return MessageInterface
 25      */
 26     public function getMessage()
 27     {
 28         return $this->message;
 29     }
 30 
 31     /**
 32      * {@inheritdoc}
 33      */
 34     public function getProtocolVersion()
 35     {
 36         return $this->message->getProtocolVersion();
 37     }
 38 
 39     /**
 40      * {@inheritdoc}
 41      */
 42     public function withProtocolVersion($version)
 43     {
 44         $new = clone $this;
 45         $new->message = $this->message->withProtocolVersion($version);
 46 
 47         return $new;
 48     }
 49 
 50     /**
 51      * {@inheritdoc}
 52      */
 53     public function getHeaders()
 54     {
 55         return $this->message->getHeaders();
 56     }
 57 
 58     /**
 59      * {@inheritdoc}
 60      */
 61     public function hasHeader($header)
 62     {
 63         return $this->message->hasHeader($header);
 64     }
 65 
 66     /**
 67      * {@inheritdoc}
 68      */
 69     public function getHeader($header)
 70     {
 71         return $this->message->getHeader($header);
 72     }
 73 
 74     /**
 75      * {@inheritdoc}
 76      */
 77     public function getHeaderLine($header)
 78     {
 79         return $this->message->getHeaderLine($header);
 80     }
 81 
 82     /**
 83      * {@inheritdoc}
 84      */
 85     public function withHeader($header, $value)
 86     {
 87         $new = clone $this;
 88         $new->message = $this->message->withHeader($header, $value);
 89 
 90         return $new;
 91     }
 92 
 93     /**
 94      * {@inheritdoc}
 95      */
 96     public function withAddedHeader($header, $value)
 97     {
 98         $new = clone $this;
 99         $new->message = $this->message->withAddedHeader($header, $value);
100 
101         return $new;
102     }
103 
104     /**
105      * {@inheritdoc}
106      */
107     public function withoutHeader($header)
108     {
109         $new = clone $this;
110         $new->message = $this->message->withoutHeader($header);
111 
112         return $new;
113     }
114 
115     /**
116      * {@inheritdoc}
117      */
118     public function getBody()
119     {
120         return $this->message->getBody();
121     }
122 
123     /**
124      * {@inheritdoc}
125      */
126     public function withBody(StreamInterface $body)
127     {
128         $new = clone $this;
129         $new->message = $this->message->withBody($body);
130 
131         return $new;
132     }
133 }
134 
API documentation generated by ApiGen