Completed
Push — master ( b2db07...6ada9a )
by luca
08:41
created

Segment::getIntegrationCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Audiens\DoubleclickClient\entity;
4
5
use Audiens\DoubleclickClient\exceptions\ClientException;
6
7
/**
8
 * Class Segment
9
 */
10
class Segment
11
{
12
13
    /**
14
     * @var int
15
     */
16
    protected $segmentId;
17
18
    /**
19
     * @var string
20
     */
21
    protected $segmentName;
22
23
    /**
24
     * @var string
25
     */
26
    protected $segmentStatus;
27
28
    /**
29
     * @var string
30
     */
31
    protected $description;
32
33
    /**
34
     * @var string
35
     */
36
    protected $integrationCode;
37
38
    /**
39
     * @var string
40
     */
41
    protected $accountUserListStatus;
42
43
    /**
44
     * @var string
45
     */
46
    protected $accessReason;
47
48
    /**
49
     * @var boolean
50
     */
51
    protected $isEligibleForSearch;
52
53
    /**
54
     * @var float
55
     */
56
    protected $membershipLifeSpan;
57
58
    /**
59
     * @var string
60
     */
61
    protected $listType;
62
63
    /**
64
     * @var string
65
     */
66
    protected $size;
67
68
    /**
69
     * Segment constructor.
70
     *
71
     * @param int $segmentId
72
     * @param string $segmentName
73
     * @param string $segmentStatus
74
     * @param string $description
75
     * @param string $integrationCode
76
     * @param string $accountUserListStatus
77
     * @param $accessReason
78
     * @param $isEligibleForSearch
79
     * @param $membershipLifeSpan
80
     */
81
    public function __construct($segmentId, $segmentName, $segmentStatus, $description = null, $integrationCode = null, $accountUserListStatus = null, $accessReason = null, $isEligibleForSearch = null, $membershipLifeSpan = null)
82
    {
83
        $this->segmentId = $segmentId;
84
        $this->segmentName = $segmentName;
85
        $this->segmentStatus = $segmentStatus;
86
        $this->description = $description;
87
        $this->integrationCode = $integrationCode;
88
        $this->accountUserListStatus = $accountUserListStatus;
89
        $this->accessReason = $accessReason;
90
        $this->isEligibleForSearch = $isEligibleForSearch;
91
        $this->membershipLifeSpan = $membershipLifeSpan;
92
    }
93
94
95
    /**
96
     * @return int
97
     */
98
    public function getSegmentId()
99
    {
100
        return $this->segmentId;
101
    }
102
103
    /**
104
     * @return string
105
     */
106
    public function getSegmentName()
107
    {
108
        return $this->segmentName;
109
    }
110
111
    /**
112
     * @param $name
113
     */
114
    public function setSegmentName($name)
115
    {
116
        $this->segmentName = $name;
117
    }
118
119
    /**
120
     * @return string
121
     */
122
    public function getSegmentStatus()
123
    {
124
        return $this->segmentStatus;
125
    }
126
127
    /**
128
     * @return string
129
     */
130
    public function getDescription()
131
    {
132
        return $this->description;
133
    }
134
135
    /**
136
     * @param string $description
137
     */
138
    public function setDescription($description)
139
    {
140
        $this->description = $description;
141
    }
142
143
    /**
144
     * @return string
145
     */
146
    public function getIntegrationCode()
147
    {
148
        return $this->integrationCode;
149
    }
150
151
    /**
152
     * @param string $integrationCode
153
     */
154
    public function setIntegrationCode($integrationCode)
155
    {
156
        $this->integrationCode = $integrationCode;
157
    }
158
159
    /**
160
     * @return string
161
     */
162
    public function getAccountUserListStatus()
163
    {
164
        return $this->accountUserListStatus;
165
    }
166
167
    /**
168
     * @param string $accountUserListStatus
169
     */
170
    public function setAccountUserListStatus($accountUserListStatus)
171
    {
172
        $this->accountUserListStatus = $accountUserListStatus;
173
    }
174
175
    /**
176
     * @return mixed
177
     */
178
    public function getAccessReason()
179
    {
180
        return $this->accessReason;
181
    }
182
183
    /**
184
     * @param mixed $accessReason
185
     */
186
    public function setAccessReason($accessReason)
187
    {
188
        $this->accessReason = $accessReason;
189
    }
190
191
    /**
192
     * @return mixed
193
     */
194
    public function getisEligibleForSearch()
195
    {
196
        return $this->isEligibleForSearch;
197
    }
198
199
    /**
200
     * @param mixed $isEligibleForSearch
201
     */
202
    public function setIsEligibleForSearch($isEligibleForSearch)
203
    {
204
        $this->isEligibleForSearch = $isEligibleForSearch;
205
    }
206
207
    /**
208
     * @return mixed
209
     */
210
    public function getMembershipLifeSpan()
211
    {
212
        return $this->membershipLifeSpan;
213
    }
214
215
    /**
216
     * @param mixed $membershipLifeSpan
217
     */
218
    public function setMembershipLifeSpan($membershipLifeSpan)
219
    {
220
        $this->membershipLifeSpan = $membershipLifeSpan;
221
    }
222
223
    /**
224
     * @return mixed
225
     */
226
    public function getListType()
227
    {
228
        return $this->listType;
229
    }
230
231
    /**
232
     * @param  $listType
233
     */
234
    public function setListType($listType)
235
    {
236
        $this->listType = $listType;
237
    }
238
239
    /**
240
     * @return mixed
241
     */
242
    public function getSize()
243
    {
244
        return $this->size;
245
    }
246
247
    /**
248
     * @param mixed $size
249
     */
250
    public function setSize($size)
251
    {
252
        $this->size = $size;
253
    }
254
255
256
    public static function fromArray(array $array)
257
    {
258
259
260
        if (!isset($array['id'])) {
261
            throw ClientException::validation('hydration: id');
262
        }
263
264
        if (!isset($array['name'])) {
265
            throw ClientException::validation('hydration: name');
266
        }
267
268
        if (!isset($array['status'])) {
269
            throw ClientException::validation('hydration: status');
270
        }
271
272
        $segment = new self(
273
            $array['id'],
274
            $array['name'],
275
            $array['status']
276
        );
277
278
279 View Code Duplication
        if (isset($array['description']) && !is_array($array['description'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
280
            $segment->setDescription($array['description']);
281
        }
282
283
284 View Code Duplication
        if (isset($array['accountuserliststatus']) && !is_array($array['accountuserliststatus'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
285
            $segment->setAccountUserListStatus($array['accountuserliststatus']);
286
        }
287 View Code Duplication
        if (isset($array['accessreason']) && !is_array($array['accessreason'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
288
            $segment->setAccessReason($array['accessreason']);
289
        }
290
291 View Code Duplication
        if (isset($array['iseligibleforsearch']) && !is_array($array['iseligibleforsearch'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
292
            $segment->setIsEligibleForSearch($array['iseligibleforsearch']);
293
        }
294 View Code Duplication
        if (isset($array['membershiplifespan']) && !is_array($array['membershiplifespan'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
295
            $segment->setMembershipLifeSpan($array['membershiplifespan']);
296
        }
297
298 View Code Duplication
        if (isset($array['listtype']) && !is_array($array['listtype'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
299
            $segment->setListType($array['listtype']);
300
        }
301
302 View Code Duplication
        if (isset($array['size']) && !is_array($array['size'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
303
            $segment->setSize($array['size']);
304
        }
305
306 View Code Duplication
        if (isset($array['integrationcode']) && !is_array($array['integrationcode'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
307
            $segment->setIntegrationCode($array['integrationcode']);
308
        }
309
310
        return $segment;
311
    }
312
}
313