From 3bd52a15d63c5dae3798566eca022c9a01ec1d67 Mon Sep 17 00:00:00 2001 From: Andrii Vasyliev Date: Wed, 31 May 2017 15:44:19 +0200 Subject: [PATCH] added ManualResponse --- src/ManualResponse.php | 112 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 src/ManualResponse.php diff --git a/src/ManualResponse.php b/src/ManualResponse.php new file mode 100644 index 0000000..0c9f799 --- /dev/null +++ b/src/ManualResponse.php @@ -0,0 +1,112 @@ +request = $request; + $this->data = $data; + $this->headers = $headers; + $this->statusCode = $statusCode; + $this->reasonPhrase = $reasonPhrase; + } + + /** + * @return mixed + */ + public function getData() + { + return $this->data; + } + + /** + * @return mixed + */ + public function getRawData() + { + return $this->data; + } + + /** + * @param string $name the header name + * @return array|null + */ + public function getHeader($name) + { + return isset($this->headers[strtolower($name)]) ? $this->headers[strtolower($name)] : null; + } + + /** + * {@inheritdoc} + */ + public function getStatusCode() + { + return $this->statusCode; + } + + /** + * {@inheritdoc} + */ + public function getReasonPhrase() + { + return $this->reasonPhrase; + } + + /** + * Returns array of all headers. + * Key - Header name + * Value - array of header values. For example:. + * + * ```php + * ['Location' => ['http://example.com'], 'Expires' => ['Thu, 01 Jan 1970 00:00:00 GMT']] + * @return array + */ + public function getHeaders() + { + return $this->headers; + } +}