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

ClientHelpers   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 7
lcom 1
cbo 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponse() 0 4 1
A context() 0 4 1
A getBody() 0 4 1
A wasSuccessful() 0 4 1
A getStatusCode() 0 4 1
A code() 0 4 1
A error() 0 4 1
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
}