Test Failed
Branch master (d80a5c)
by
unknown
05:06
created

ClientHelpers::code()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author  Rizart Dokollari <[email protected]>
4
 * @since   12/24/17
5
 */
6
7
namespace ElasticEmail;
8
9
10
trait ClientHelpers
11
{
12
    /** @var  \GuzzleHttp\Psr7\Response */
13
    protected $response;
14
15
    public function getResponse()
16
    {
17
        return $this->response;
18
    }
19
20
    public function context()
21
    {
22
        return $this->getBody()->Context;
23
    }
24
25
    public function getBody()
26
    {
27
        return json_decode((string)$this->response->getBody());
28
    }
29
30
    public function wasSuccessful()
31
    {
32
        return $this->getBody()->success;
33
    }
34
35
    public function getStatusCode()
36
    {
37
        return $this->response->getStatusCode();
38
    }
39
40
    public function code()
41
    {
42
        return $this->getBody()->Code;
43
    }
44
45
    public function error()
46
    {
47
        return $this->getBody()->error;
48
    }
49
50
}