1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41:
<?php
namespace Angelfon\SDK\Http;
class Response
{
protected $headers;
protected $content;
protected $statusCode;
public function __construct($statusCode, $content, $headers = array())
{
$this->statusCode = $statusCode;
$this->content = $content;
$this->headers = $headers;
}
public function getContent()
{
return json_decode($this->content, true);
}
public function getStatusCode()
{
return $this->statusCode;
}
public function getHeaders()
{
return $this->headers;
}
public function ok()
{
return $this->getStatusCode() < 400;
}
public function __toString()
{
return '[Response] HTTP ' . $this->getStatusCode() . ' ' . $this->content;
}
}