VoysResponse::getANumber()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
cc 1
nc 1
nop 0
rs 10
1
<?php
2
3
namespace Jcid\Voys;
4
5
use GuzzleHttp\Psr7\Response;
6
use Webmozart\Json\JsonDecoder;
7
8
final class VoysResponse
9
{
10
    /**
11
     * @var string
12
     */
13
    private $a_cli;
14
15
    /**
16
     * @var string
17
     */
18
    private $a_number;
19
20
    /**
21
     * @var bool
22
     */
23
    private $auto_answer;
24
25
    /**
26
     * @var string
27
     */
28
    private $b_cli;
29
30
    /**
31
     * @var string
32
     */
33
    private $b_number;
34
35
    /**
36
     * @var string
37
     */
38
    private $callid;
39
40
    /**
41
     * @var string
42
     */
43
    private $created;
44
45
    /**
46
     * @var string
47
     */
48
    private $originating_ip;
49
50
    /**
51
     * @var string
52
     */
53
    private $resource_uri;
54
55
    /**
56
     * @var string
57
     */
58
    private $status;
59
60
    /**
61
     * @param Response $response
62
     */
63
    public function __construct(Response $response)
64
    {
65
        $jsonDecoder = new JsonDecoder();
66
        $responseObject = $jsonDecoder->decode($response->getBody()->getContents());
67
68
        $this->a_cli = $responseObject->a_cli;
69
        $this->a_number = $responseObject->a_number;
70
        $this->auto_answer = $responseObject->auto_answer;
71
        $this->b_cli = $responseObject->b_cli;
72
        $this->b_number = $responseObject->b_number;
73
        $this->callid = $responseObject->callid;
74
        $this->created = $responseObject->created;
75
        $this->originating_ip = $responseObject->originating_ip;
76
        $this->resource_uri = $responseObject->resource_uri;
77
        $this->status = $responseObject->status;
78
    }
79
80
    /**
81
     * @return string
82
     */
83
    public function getACli(): string
84
    {
85
        return $this->a_cli;
86
    }
87
88
    /**
89
     * @return string
90
     */
91
    public function getANumber(): string
92
    {
93
        return $this->a_number;
94
    }
95
96
    /**
97
     * @return bool
98
     */
99
    public function isAutoAnswer(): bool
100
    {
101
        return $this->auto_answer;
102
    }
103
104
    /**
105
     * @return string
106
     */
107
    public function getBCli(): string
108
    {
109
        return $this->b_cli;
110
    }
111
112
    /**
113
     * @return string
114
     */
115
    public function getBNumber(): string
116
    {
117
        return $this->b_number;
118
    }
119
120
    /**
121
     * @return string
122
     */
123
    public function getCallid(): string
124
    {
125
        return $this->callid;
126
    }
127
128
    /**
129
     * @return string
130
     */
131
    public function getCreated(): string
132
    {
133
        return $this->created;
134
    }
135
136
    /**
137
     * @return string
138
     */
139
    public function getOriginatingIp(): string
140
    {
141
        return $this->originating_ip;
142
    }
143
144
    /**
145
     * @return string
146
     */
147
    public function getResourceUri(): string
148
    {
149
        return $this->resource_uri;
150
    }
151
152
    /**
153
     * @return string
154
     */
155
    public function getStatus(): string
156
    {
157
        return $this->status;
158
    }
159
}
160