/** * @param int $statusCode * @param array $headers * @param StreamInterface $body */ public function __construct($statusCode = 200, $reasonPhrase = '', array $headers = [], StreamInterface $body = null) { $this->validStatusCode($statusCode); $this->statusCode = $statusCode; $this->reasonPhrase = $this->filterReasonPhrase($statusCode, $reasonPhrase); parent::__construct('1.1', $headers, $body); }
public function testGetBody() { $mockBody = Mockery::mock(StreamInterface::class); // Gets the body of the message. $message = new Message('1.0', [], $mockBody); $this->assertSame($mockBody, $message->getBody()); $message = new Message('1.0', []); $this->assertNull($message->getBody()); // return null }
/** * @param string $httpVersion * @param string $method * @param UriInterface $uri * @param array $headers * @param StreamInterface $body */ public function __construct($httpVersion, $method = null, UriInterface $uri = null, array $headers = [], StreamInterface $body = null) { $this->method = $this->filterMethod($method); $this->uri = $uri; parent::__construct($httpVersion, $headers, $body); }