for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Raidros\Storer;
use GuzzleHttp\Psr7\Response as Psr7Response;
use Raidros\Storer\Exception\ResponseWithoutBody;
class Response
{
protected $response;
protected $transformer;
/**
* Api response.
*
* @param Psr7Response $response
* @param Transformer|null $transformer
*/
public function __construct(Psr7Response $response, Transformer $transformer = null)
$this->response = $response;
$this->transformer = $transformer;
}
* get the guzzle promisse.
* @return GuzzleHttp\Psr7\Response
public function promise()
return $this->response;
* Return a transformed response.
* @return array
public function getBody()
$body = json_decode($this->response->getBody(), true);
if (!$body) {
throw new ResponseWithoutBody('Response without body');
if (!$this->transformer) {
return $body;
return $this->transformer->transformData($body);