summaryrefslogtreecommitdiffstats
path: root/lib/Response.php
diff options
context:
space:
mode:
authormisantron <misantron@gmail.com>2016-07-09 01:06:33 +0300
committermisantron <misantron@gmail.com>2016-07-09 01:06:33 +0300
commit5af53adbcadf57f3a154e7ae8d8a50b64c414390 (patch)
tree4448d3d1b4fb1819b62a84017f98f1a1561308d2 /lib/Response.php
parent1c766087ca9e180c37000534c97b43fc8c1d66ad (diff)
downloadphp-http-client-5af53adbcadf57f3a154e7ae8d8a50b64c414390.zip
php-http-client-5af53adbcadf57f3a154e7ae8d8a50b64c414390.tar.gz
php-http-client-5af53adbcadf57f3a154e7ae8d8a50b64c414390.tar.bz2
Bump composer PHP version to 5.4, library refactoring to PSR-2 and PSR-4 standards
Diffstat (limited to 'lib/Response.php')
-rw-r--r--lib/Response.php73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/Response.php b/lib/Response.php
new file mode 100644
index 0000000..bc04e1f
--- /dev/null
+++ b/lib/Response.php
@@ -0,0 +1,73 @@
+<?php
+
+/**
+ * HTTP Client library
+ *
+ * PHP version 5.4
+ *
+ * @author Matt Bernier <dx@sendgrid.com>
+ * @author Elmer Thomas <dx@sendgrid.com>
+ * @copyright 2016 SendGrid
+ * @license https://opensource.org/licenses/MIT The MIT License
+ * @version GIT: <git_id>
+ * @link http://packagist.org/packages/sendgrid/php-http-client
+ */
+
+namespace SendGrid;
+
+/**
+ * Holds the response from an API call.
+ */
+class Response
+{
+ /** @var int */
+ protected $statusCode;
+ /** @var string */
+ protected $body;
+ /** @var array */
+ protected $headers;
+
+ /**
+ * Setup the response data
+ *
+ * @param int $statusCode the status code.
+ * @param string $body the response body.
+ * @param array $headers an array of response headers.
+ */
+ public function __construct($statusCode = null, $body = null, $headers = null)
+ {
+ $this->statusCode = $statusCode;
+ $this->body = $body;
+ $this->headers = $headers;
+ }
+
+ /**
+ * The status code
+ *
+ * @return int
+ */
+ public function statusCode()
+ {
+ return $this->statusCode;
+ }
+
+ /**
+ * The response body
+ *
+ * @return string
+ */
+ public function body()
+ {
+ return $this->body;
+ }
+
+ /**
+ * The response headers
+ *
+ * @return array
+ */
+ public function headers()
+ {
+ return $this->headers;
+ }
+} \ No newline at end of file