Completed
Push — master ( 088987...65ed73 )
by Brian
03:46
created

BridgeAttendedTransfer::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 28
ccs 0
cts 27
cp 0
rs 8.8571
cc 1
eloc 25
nc 1
nop 2
crap 2
1
<?php
2
3
/*
4
 * Copyright 2014 Brian Smith <[email protected]>.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *      http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace phparia\Events;
20
21
use phparia\Client\AriClient;
22
use phparia\Resources\Channel;
23
use phparia\Resources\Bridge;
24
25
/**
26
 * Notification that an attended transfer has occurred.
27
 *
28
 * @author Brian Smith <[email protected]>
29
 */
30
class BridgeAttendedTransfer extends BridgeTransfer
31
{
32
    /**
33
     * @var string (optional) - Application that has been transferred into
34
     */
35
    private $destinationApplication;
36
37
    /**
38
     * @var string (optional) - Bridge that survived the merge result
39
     */
40
    private $destinationBridge;
41
42
    /**
43
     * @var Channel (optional) - First leg of a link transfer result
44
     */
45
    private $destinationLinkFirstLeg;
46
47
    /**
48
     * @var Channel (optional) - Second leg of a link transfer result
49
     */
50
    private $destinationLinkSecondLeg;
51
52
    /**
53
     * @var Bridge (optional) - Bridge that survived the threeway result
54
     */
55
    private $destinationThreewayBridge;
56
57
    /**
58
     * @var Channel (optional) - Transferer channel that survived the threeway result
59
     */
60
    private $destinationThreewayChannel;
61
62
    /**
63
     * @var string How the transfer was accomplished
64
     */
65
    private $destinationType;
66
67
    /**
68
     * @var boolean Whether the transfer was externally initiated or not
69
     */
70
    private $isExternal;
71
72
    /**
73
     * @var Channel (optional) - The channel that is replacing transferer_first_leg in the swap
74
     */
75
    private $replaceChannel;
76
77
    /**
78
     * @var string The result of the transfer attempt
79
     */
80
    private $result;
81
82
    /**
83
     * @var Channel (optional) - The channel that is being transferred to
84
     */
85
    private $transferTarget;
86
87
    /**
88
     * @var Channel (optional) - The channel that is being transferred
89
     */
90
    private $transferee;
91
92
    /**
93
     * @var Channel First leg of the transferer
94
     */
95
    private $transfererFirstLeg;
96
97
    /**
98
     * @var Bridge (optional) - Bridge the transferer first leg is in
99
     */
100
    private $transfererFirstLegBridge;
101
102
    /**
103
     * @var Channel Second leg of the transferer
104
     */
105
    private $transfererSecondLeg;
106
107
    /**
108
     * @var Bridge (optional) - Bridge the transferer second leg is in
109
     */
110
    private $transfererSecondLegBridge;
111
112
    /**
113
     * @return string (optional) - Application that has been transferred into
114
     */
115
    public function getDestinationApplication()
116
    {
117
        return $this->destinationApplication;
118
    }
119
120
    /**
121
     * @return string (optional) - Bridge that survived the merge result
122
     */
123
    public function getDestinationBridge()
124
    {
125
        return $this->destinationBridge;
126
    }
127
128
    /**
129
     * @return Channel (optional) - First leg of a link transfer result
130
     */
131
    public function getDestinationLinkFirstLeg()
132
    {
133
        return $this->destinationLinkFirstLeg;
134
    }
135
136
    /**
137
     * @return Channel (optional) - Second leg of a link transfer result
138
     */
139
    public function getDestinationLinkSecondLeg()
140
    {
141
        return $this->destinationLinkSecondLeg;
142
    }
143
144
    /**
145
     * @return Bridge (optional) - Bridge that survived the threeway result
146
     */
147
    public function getDestinationThreewayBridge()
148
    {
149
        return $this->destinationThreewayBridge;
150
    }
151
152
    /**
153
     * @return Channel (optional) - Transferer channel that survived the threeway result
154
     */
155
    public function getDestinationThreewayChannel()
156
    {
157
        return $this->destinationThreewayChannel;
158
    }
159
160
    /**
161
     * @return string How the transfer was accomplished
162
     */
163
    public function getDestinationType()
164
    {
165
        return $this->destinationType;
166
    }
167
168
    /**
169
     * @return boolean Whether the transfer was externally initiated or not
170
     */
171
    public function isExternal()
172
    {
173
        return $this->isExternal;
174
    }
175
176
    /**
177
     * @return Channel (optional) - The channel that is replacing transferer_first_leg in the swap
178
     */
179
    public function getReplaceChannel()
180
    {
181
        return $this->replaceChannel;
182
    }
183
184
    /**
185
     * @return string The result of the transfer attempt
186
     */
187
    public function getResult()
188
    {
189
        return $this->result;
190
    }
191
192
    /**
193
     * @return Channel (optional) - The channel that is being transferred to
194
     */
195
    public function getTransferTarget()
196
    {
197
        return $this->transferTarget;
198
    }
199
200
    /**
201
     * @return Channel (optional) - The channel that is being transferred
202
     */
203
    public function getTransferee()
204
    {
205
        return $this->transferee;
206
    }
207
208
    /**
209
     * @return Channel First leg of the transferer
210
     */
211
    public function getTransfererFirstLeg()
212
    {
213
        return $this->transfererFirstLeg;
214
    }
215
216
    /**
217
     * @return Bridge (optional) - Bridge the transferer first leg is in
218
     */
219
    public function getTransfererFirstLegBridge()
220
    {
221
        return $this->transfererFirstLegBridge;
222
    }
223
224
    /**
225
     * @return Channel Second leg of the transferer
226
     */
227
    public function getTransfererSecondLeg()
228
    {
229
        return $this->transfererSecondLeg;
230
    }
231
232
    /**
233
     * @return Bridge (optional) - Bridge the transferer second leg is in
234
     */
235
    public function getTransfererSecondLegBridge()
236
    {
237
        return $this->transfererSecondLegBridge;
238
    }
239
240
    /**
241
     * @param AriClient $client
242
     * @param string $response
243
     */
244
    public function __construct(AriClient $client, $response)
245
    {
246
        parent::__construct($client, $response);
247
248
        $this->destinationApplication = $this->getResponseValue('destination_application');
249
        $this->destinationBridge = $this->getResponseValue('destination_bridge');
250
        $this->destinationLinkFirstLeg = $this->getResponseValue('destination_link_first_leg',
251
            '\phparia\Resources\Channel', $client);
252
        $this->destinationLinkSecondLeg = $this->getResponseValue('destination_link_second_leg');
253
        $this->destinationThreewayBridge = $this->getResponseValue('destination_threeway_bridge',
254
            '\phparia\Resources\Bridge', $client);
255
        $this->destinationThreewayChannel = $this->getResponseValue('destination_threeway_channel',
256
            '\phparia\Resources\Channel', $client);
257
        $this->destinationType = $this->getResponseValue('destination_type');
258
        $this->isExternal = $this->getResponseValue('is_external');
259
        $this->replaceChannel = $this->getResponseValue('replace_channel', '\phparia\Resources\Channel', $client);
260
        $this->result = $this->getResponseValue('result');
261
        $this->transferTarget = $this->getResponseValue('transfer_target', '\phparia\Resources\Channel', $client);
262
        $this->transferee = $this->getResponseValue('transferee', '\phparia\Resources\Channel', $client);
263
        $this->transfererFirstLeg = $this->getResponseValue('transferer_first_leg', '\phparia\Resources\Channel',
264
            $client);
265
        $this->transfererFirstLegBridge = $this->getResponseValue('transferer_first_leg_bridge',
266
            '\phparia\Resources\Bridge', $client);
267
        $this->transfererSecondLeg = $this->getResponseValue('transferer_second_leg', '\phparia\Resources\Channel',
268
            $client);
269
        $this->transfererSecondLegBridge = $this->getResponseValue('transferer_second_leg_bridge',
270
            '\phparia\Resources\Bridge', $client);
271
    }
272
}
273