for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Slacky\Http;
use Slacky\Contracts\Http\Response;
/**
* Class SlackResponse
* @package Frlnc\Slack\Http
*/
class SlackResponse implements Response, \JsonSerializable {
* The response body.
*
* @var string
protected $body;
* The response headers.
* @var array
protected $headers;
* The response status code.
* @var integer
protected $statusCode;
* @param string $body
* @param array $headers
* @param integer $statusCode
public function __construct($body, array $headers = [], $statusCode = 404)
{
$this->body = json_decode($body, true);
$this->headers = $headers;
$this->statusCode = $statusCode;
}
* {@inheritdoc}
public function getBody(): array
return $this->body;
return $this->body
string
array
public function getHeaders(): array
return $this->headers;
public function getStatusCode(): int
return $this->statusCode;
public function jsonSerialize()
return $this->toArray();
* Converts the response to an array.
* @return array
public function toArray() : array
return [
'status_code' => $this->getStatusCode(),
'headers' => $this->getHeaders(),
'body' => $this->getBody()
];