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\ResponseInterface;
 6 
 7 /**
 8  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
 9  */
10 trait ResponseDecorator
11 {
12     use MessageDecorator {
13         getMessage as getResponse;
14     }
15 
16     /**
17      * Exchanges the underlying response with another.
18      *
19      * @param ResponseInterface $response
20      *
21      * @return self
22      */
23     public function withResponse(ResponseInterface $response)
24     {
25         $new = clone $this;
26         $new->message = $response;
27 
28         return $new;
29     }
30 
31     /**
32      * {@inheritdoc}
33      */
34     public function getStatusCode()
35     {
36         return $this->message->getStatusCode();
37     }
38 
39     /**
40      * {@inheritdoc}
41      */
42     public function withStatus($code, $reasonPhrase = '')
43     {
44         $new = clone $this;
45         $new->message = $this->message->withStatus($code, $reasonPhrase);
46 
47         return $new;
48     }
49 
50     /**
51      * {@inheritdoc}
52      */
53     public function getReasonPhrase()
54     {
55         return $this->message->getReasonPhrase();
56     }
57 }
58 
API documentation generated by ApiGen