/** * Construct a Mailjet response * @param Request $request Mailjet actual request * @param GuzzleResponse $response Guzzle response */ public function __construct($request, $response) { $this->request = $request; if ($response) { $this->status = $response->getStatusCode(); $this->body = json_decode($response->getBody(), true); $this->success = floor($this->status / 100) == 2 ? true : false; } }
/** * Get status code from http response. * * @param GuzzleResponse $response * @return integer */ public function getStatus($response) { return (int) $response->getStatusCode(); }