Passed
Push — master ( ac5429...699403 )
by Ross
02:06
created

Plan::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 2
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://www.gnu.org/licenses/>.
21
 */
22
23
namespace RossMitchell\UpdateCloudFlare\Responses\Results;
24
25
use RossMitchell\UpdateCloudFlare\Helpers\Hydrator;
26
use Symfony\Component\Console\Exception\LogicException;
27
28
class Plan
29
{
30
    /**
31
     * @var string
32
     */
33
    private $id;
34
    /**
35
     * @var string
36
     */
37
    private $name;
38
    /**
39
     * @var float
40
     */
41
    private $price;
42
    /**
43
     * @var string
44
     */
45
    private $currency;
46
    /**
47
     * @var string
48
     */
49
    private $frequency;
50
    /**
51
     * @var string
52
     */
53
    private $legacyId;
54
    /**
55
     * @var string
56
     */
57
    private $isSubscribed;
58
    /**
59
     * @var string
60
     */
61
    private $canSubscribe;
62
63
    /**
64
     * Plan constructor.
65
     *
66
     * @param Hydrator  $hydrator
67
     * @param \stdClass $data
68
     *
69
     * @throws LogicException
70
     */
71
    public function __construct(Hydrator $hydrator, \stdClass $data)
72
    {
73
        $hydrator->setProperty($this, $data, 'id');
74
        $hydrator->setProperty($this, $data, 'name');
75
        $hydrator->setProperty($this, $data, 'price');
76
        $hydrator->setProperty($this, $data, 'currency');
77
        $hydrator->setProperty($this, $data, 'frequency');
78
        $hydrator->setProperty($this, $data, 'legacy_id');
79
        $hydrator->setProperty($this, $data, 'is_subscribed');
80
        $hydrator->setProperty($this, $data, 'can_subscribe');
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function getId(): string
87
    {
88
        return $this->id;
89
    }
90
91
    /**
92
     * @param string $id
93
     */
94
    public function setId(string $id)
95
    {
96
        $this->id = $id;
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function getName(): string
103
    {
104
        return $this->name;
105
    }
106
107
    /**
108
     * @param string $name
109
     */
110
    public function setName(string $name)
111
    {
112
        $this->name = $name;
113
    }
114
115
    /**
116
     * @return float
117
     */
118
    public function getPrice(): float
119
    {
120
        return $this->price;
121
    }
122
123
    /**
124
     * @param float $price
125
     */
126
    public function setPrice(float $price)
127
    {
128
        $this->price = $price;
129
    }
130
131
    /**
132
     * @return string
133
     */
134
    public function getCurrency(): string
135
    {
136
        return $this->currency;
137
    }
138
139
    /**
140
     * @param string $currency
141
     */
142
    public function setCurrency(string $currency)
143
    {
144
        $this->currency = $currency;
145
    }
146
147
    /**
148
     * @return string
149
     */
150
    public function getFrequency(): string
151
    {
152
        return $this->frequency;
153
    }
154
155
    /**
156
     * @param string $frequency
157
     */
158
    public function setFrequency(string $frequency)
159
    {
160
        $this->frequency = $frequency;
161
    }
162
163
    /**
164
     * @return string
165
     */
166
    public function getLegacyId(): string
167
    {
168
        return $this->legacyId;
169
    }
170
171
    /**
172
     * @param string $legacyId
173
     */
174
    public function setLegacyId(string $legacyId)
175
    {
176
        $this->legacyId = $legacyId;
177
    }
178
179
    /**
180
     * @return string
181
     */
182
    public function getisSubscribed(): string
183
    {
184
        return $this->isSubscribed;
185
    }
186
187
    /**
188
     * @param string $isSubscribed
189
     */
190
    public function setIsSubscribed(string $isSubscribed)
191
    {
192
        $this->isSubscribed = $isSubscribed;
193
    }
194
195
    /**
196
     * @return string
197
     */
198
    public function getCanSubscribe(): string
199
    {
200
        return $this->canSubscribe;
201
    }
202
203
    /**
204
     * @param string $canSubscribe
205
     */
206
    public function setCanSubscribe(string $canSubscribe)
207
    {
208
        $this->canSubscribe = $canSubscribe;
209
    }
210
}
211