Passed
Push — master ( 7bbbd6...f6fec9 )
by Ross
03:14 queued 44s
created

ListZonesResult::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 17
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 17
cts 17
cp 1
rs 9.0856
c 0
b 0
f 0
cc 1
eloc 16
nc 1
nop 4
crap 1
1
<?php
2
declare(strict_types = 1);
3
/**
4
 *
5
 * Copyright (C) 2018  Ross Mitchell
6
 *
7
 * This file is part of RossMitchell/UpdateCloudFlare.
8
 *
9
 * RossMitchell/UpdateCloudFlare is free software: you can redistribute
10
 * it and/or modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation, either version 3 of the
12
 * License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program. If not, see <http:
21
 */
22
23
namespace RossMitchell\UpdateCloudFlare\Responses\Results;
24
25
use RossMitchell\UpdateCloudFlare\Factories\Responses\Results\OwnerFactory;
26
use RossMitchell\UpdateCloudFlare\Factories\Responses\Results\PlanFactory;
27
use RossMitchell\UpdateCloudFlare\Helpers\Hydrator;
28
use Symfony\Component\Console\Exception\LogicException;
29
30
/**
31
 * Class ListZones
32
 * @package RossMitchell\UpdateCloudFlare\Responses\Results
33
 */
34
class ListZonesResult
35
{
36
    /**
37
     * @var string
38
     */
39
    private $id;
40
    /**
41
     * @var string
42
     */
43
    private $name;
44
    /**
45
     * @var int
46
     */
47
    private $developmentMode;
48
    /**
49
     * @var array
50
     */
51
    private $originalNameServers;
52
    /**
53
     * @var string
54
     */
55
    private $originalRegistrar;
56
    /**
57
     * @var string
58
     */
59
    private $originalDnsHost;
60
    /**
61
     * @var string
62
     */
63
    private $createdOn;
64
    /**
65
     * @var string
66
     */
67
    private $modifiedOn;
68
    /**
69
     * @var Owner
70
     */
71
    private $owner;
72
    /**
73
     * @var array
74
     */
75
    private $permissions;
76
    /**
77
     * @var Plan
78
     */
79
    private $plan;
80
    /**
81
     * @var Plan
82
     */
83
    private $planPending;
84
    /**
85
     * @var string
86
     */
87
    private $status;
88
    /**
89
     * @var bool
90
     */
91
    private $paused;
92
    /**
93
     * @var string
94
     */
95
    private $type;
96
    /**
97
     * @var array
98
     */
99
    private $nameServers;
100
101
    /**
102
     * ListZonesResult constructor.
103
     *
104
     * @param Hydrator     $hydrator
105
     * @param OwnerFactory $ownerFactory
106
     * @param PlanFactory  $planFactory
107
     * @param \stdClass    $data
108
     *
109
     * @throws LogicException
110
     */
111 17
    public function __construct(
112
        Hydrator $hydrator,
113
        OwnerFactory $ownerFactory,
114
        PlanFactory $planFactory,
115
        \stdClass $data
116
    ) {
117 17
        $hydrator->setProperty($this, $data, 'id');
118 17
        $hydrator->setProperty($this, $data, 'name');
119 17
        $hydrator->setProperty($this, $data, 'development_mode');
120 17
        $hydrator->setProperty($this, $data, 'original_name_servers');
121 17
        $hydrator->setProperty($this, $data, 'original_registrar');
122 17
        $hydrator->setProperty($this, $data, 'original_dnshost');
123 17
        $hydrator->setProperty($this, $data, 'created_on');
124 17
        $hydrator->setProperty($this, $data, 'modified_on');
125 17
        $hydrator->setProperty($this, $data, 'permissions');
126 17
        $hydrator->setProperty($this, $data, 'status');
127 17
        $hydrator->setProperty($this, $data, 'paused');
128 17
        $hydrator->setProperty($this, $data, 'type');
129 17
        $hydrator->setProperty($this, $data, 'name_servers');
130
131 17
        $this->owner       = $ownerFactory->create($data->owner);
132 17
        $this->plan        = $planFactory->create($data->plan);
133 17
        $this->planPending = $planFactory->create($data->plan_pending);
134 17
    }
135
136
    /**
137
     * @return string
138
     */
139 1
    public function getId(): string
140
    {
141 1
        return $this->id;
142
    }
143
144
    /**
145
     * @param string $id
146
     */
147 17
    public function setId(string $id)
148
    {
149 17
        $this->id = $id;
150 17
    }
151
152
    /**
153
     * @return string
154
     */
155 1
    public function getName(): string
156
    {
157 1
        return $this->name;
158
    }
159
160
    /**
161
     * @param string $name
162
     */
163 17
    public function setName(string $name)
164
    {
165 17
        $this->name = $name;
166 17
    }
167
168
    /**
169
     * @return int
170
     */
171 1
    public function getDevelopmentMode(): int
172
    {
173 1
        return $this->developmentMode;
174
    }
175
176
    /**
177
     * @param int $developmentMode
178
     */
179 17
    public function setDevelopmentMode(int $developmentMode)
180
    {
181 17
        $this->developmentMode = $developmentMode;
182 17
    }
183
184
    /**
185
     * @return array
186
     */
187 1
    public function getOriginalNameServers(): array
188
    {
189 1
        return $this->originalNameServers;
190
    }
191
192
    /**
193
     * @param array $originalNameServers
194
     */
195 17
    public function setOriginalNameServers(array $originalNameServers)
196
    {
197 17
        $this->originalNameServers = $originalNameServers;
198 17
    }
199
200
    /**
201
     * @return string
202
     */
203 1
    public function getOriginalRegistrar(): string
204
    {
205 1
        return $this->originalRegistrar;
206
    }
207
208
    /**
209
     * @param string $originalRegistrar
210
     */
211 17
    public function setOriginalRegistrar(string $originalRegistrar)
212
    {
213 17
        $this->originalRegistrar = $originalRegistrar;
214 17
    }
215
216
    /**
217
     * @return string
218
     */
219 1
    public function getOriginalDnsHost(): string
220
    {
221 1
        return $this->originalDnsHost;
222
    }
223
224
    /**
225
     * @param string $originalDnsHost
226
     */
227 17
    public function setOriginalDnsHost(string $originalDnsHost)
228
    {
229 17
        $this->originalDnsHost = $originalDnsHost;
230 17
    }
231
232
    /**
233
     * @return string
234
     */
235 1
    public function getCreatedOn(): string
236
    {
237 1
        return $this->createdOn;
238
    }
239
240
    /**
241
     * @param string $createdOn
242
     */
243 17
    public function setCreatedOn(string $createdOn)
244
    {
245 17
        $this->createdOn = $createdOn;
246 17
    }
247
248
    /**
249
     * @return string
250
     */
251 1
    public function getModifiedOn(): string
252
    {
253 1
        return $this->modifiedOn;
254
    }
255
256
    /**
257
     * @param string $modifiedOn
258
     */
259 17
    public function setModifiedOn(string $modifiedOn)
260
    {
261 17
        $this->modifiedOn = $modifiedOn;
262 17
    }
263
264
    /**
265
     * @return Owner
266
     */
267 1
    public function getOwner(): Owner
268
    {
269 1
        return $this->owner;
270
    }
271
272
    /**
273
     * @param Owner $owner
274
     */
275
    public function setOwner(Owner $owner)
276
    {
277
        $this->owner = $owner;
278
    }
279
280
    /**
281
     * @return array
282
     */
283 1
    public function getPermissions(): array
284
    {
285 1
        return $this->permissions;
286
    }
287
288
    /**
289
     * @param array $permissions
290
     */
291 17
    public function setPermissions(array $permissions)
292
    {
293 17
        $this->permissions = $permissions;
294 17
    }
295
296
    /**
297
     * @return Plan
298
     */
299 1
    public function getPlan(): Plan
300
    {
301 1
        return $this->plan;
302
    }
303
304
    /**
305
     * @param Plan $plan
306
     */
307
    public function setPlan(Plan $plan)
308
    {
309
        $this->plan = $plan;
310
    }
311
312
    /**
313
     * @return Plan
314
     */
315 1
    public function getPlanPending(): Plan
316
    {
317 1
        return $this->planPending;
318
    }
319
320
    /**
321
     * @param Plan $planPending
322
     */
323
    public function setPlanPending(Plan $planPending)
324
    {
325
        $this->planPending = $planPending;
326
    }
327
328
    /**
329
     * @return string
330
     */
331 1
    public function getStatus(): string
332
    {
333 1
        return $this->status;
334
    }
335
336
    /**
337
     * @param string $status
338
     */
339 17
    public function setStatus(string $status)
340
    {
341 17
        $this->status = $status;
342 17
    }
343
344
    /**
345
     * @return bool
346
     */
347 1
    public function isPaused(): bool
348
    {
349 1
        return $this->paused;
350
    }
351
352
    /**
353
     * @param bool $paused
354
     */
355 17
    public function setPaused(bool $paused)
356
    {
357 17
        $this->paused = $paused;
358 17
    }
359
360
    /**
361
     * @return string
362
     */
363 1
    public function getType(): string
364
    {
365 1
        return $this->type;
366
    }
367
368
    /**
369
     * @param string $type
370
     */
371 17
    public function setType(string $type)
372
    {
373 17
        $this->type = $type;
374 17
    }
375
376
    /**
377
     * @return array
378
     */
379 1
    public function getNameServers(): array
380
    {
381 1
        return $this->nameServers;
382
    }
383
384
    /**
385
     * @param array $nameServers
386
     */
387 17
    public function setNameServers(array $nameServers)
388
    {
389 17
        $this->nameServers = $nameServers;
390 17
    }
391
}
392