Completed
Push — master ( 842c53...e59924 )
by Joachim
14:33
created

Delivery::setCvr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Loevgaard\DandomainFoundation\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Loevgaard\DandomainFoundation;
7
use Loevgaard\DandomainFoundation\Entity\Generated\DeliveryInterface;
8
use Loevgaard\DandomainFoundation\Entity\Generated\DeliveryTraits;
9
10
/**
11
 * @ORM\Entity()
12
 * @ORM\Table(name="loevgaard_dandomain_deliveries")
13
 */
14
class Delivery implements DeliveryInterface
15
{
16
    use DeliveryTraits;
17
18
    /**
19
     * @var int
20
     *
21
     * @ORM\Id
22
     * @ORM\GeneratedValue
23
     * @ORM\Column(type="integer")
24
     **/
25
    protected $id;
26
27
    /**
28
     * @var string|null
29
     *
30
     * @ORM\Column(nullable=true, type="string", length=191)
31
     */
32
    protected $address;
33
34
    /**
35
     * @var string|null
36
     *
37
     * @ORM\Column(nullable=true, type="string", length=191)
38
     */
39
    protected $address2;
40
41
    /**
42
     * @var string|null
43
     *
44
     * @ORM\Column(nullable=true, type="string", length=191)
45
     */
46
    protected $attention;
47
48
    /**
49
     * @var string|null
50
     *
51
     * @ORM\Column(nullable=true, type="string", length=191)
52
     */
53
    protected $city;
54
55
    /**
56
     * @var string|null
57
     *
58
     * @ORM\Column(nullable=true, type="string", length=191)
59
     */
60
    protected $country;
61
62
    /**
63
     * @var int|null
64
     *
65
     * @ORM\Column(nullable=true, type="integer")
66
     */
67
    protected $countryId;
68
69
    /**
70
     * @var string|null
71
     *
72
     * @ORM\Column(nullable=true, type="string", length=191)
73
     */
74
    protected $cvr;
75
76
    /**
77
     * @var string|null
78
     *
79
     * @ORM\Column(nullable=true, type="string", length=191)
80
     */
81
    protected $ean;
82
83
    /**
84
     * @var string|null
85
     *
86
     * @ORM\Column(nullable=true, type="string", length=191)
87
     */
88
    protected $email;
89
90
    /**
91
     * @var string|null
92
     *
93
     * @ORM\Column(nullable=true, type="string", length=191)
94
     */
95
    protected $fax;
96
97
    /**
98
     * @var string|null
99
     *
100
     * @ORM\Column(nullable=true, type="string", length=191)
101
     */
102
    protected $name;
103
104
    /**
105
     * @var string|null
106
     *
107
     * @ORM\Column(nullable=true, type="string", length=191)
108
     */
109
    protected $phone;
110
111
    /**
112
     * @var string|null
113
     *
114
     * @ORM\Column(nullable=true, type="string", length=191)
115
     */
116
    protected $state;
117
118
    /**
119
     * @var string|null
120
     *
121
     * @ORM\Column(nullable=true, type="string", length=191)
122
     */
123
    protected $zipCode;
124
125
    /**
126
     * Populates a customer based on the response from the Dandomain API
127
     *
128
     * See the properties here:
129
     * http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/OrderService/help/operations/GetOrder
130
     *
131
     * @param \stdClass|array $data
132
     * @return DeliveryInterface
133
     */
134 View Code Duplication
    public function populateFromApiResponse($data) : DeliveryInterface
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
135
    {
136
        $data = DandomainFoundation\objectToArray($data);
137
138
        $this
139
            ->setAddress($data['address'])
140
            ->setAddress2($data['address2'])
141
            ->setAttention($data['attention'])
142
            ->setCity($data['city'])
143
            ->setCountry($data['country'])
144
            ->setCountryId($data['countryId'])
145
            ->setCvr($data['cvr'])
146
            ->setEan($data['ean'])
147
            ->setEmail($data['email'])
148
            ->setFax($data['fax'])
149
            ->setName($data['name'])
150
            ->setPhone($data['phone'])
151
            ->setState($data['state'])
152
            ->setZipCode($data['zipCode'])
153
        ;
154
155
        return $this;
156
    }
157
158
    /**
159
     * @return integer
160
     */
161
    public function getId() : int
162
    {
163
        return (int)$this->id;
164
    }
165
166
    /**
167
     * @param integer $id
168
     * @return Delivery
169
     */
170
    public function setId($id)
171
    {
172
        $this->id = $id;
173
        return $this;
174
    }
175
176
    /**
177
     * @return null|string
178
     */
179
    public function getAddress()
180
    {
181
        return $this->address;
182
    }
183
184
    /**
185
     * @param null|string $address
186
     * @return Delivery
187
     */
188
    public function setAddress($address)
189
    {
190
        $this->address = $address;
191
        return $this;
192
    }
193
194
    /**
195
     * @return null|string
196
     */
197
    public function getAddress2()
198
    {
199
        return $this->address2;
200
    }
201
202
    /**
203
     * @param null|string $address2
204
     * @return Delivery
205
     */
206
    public function setAddress2($address2)
207
    {
208
        $this->address2 = $address2;
209
        return $this;
210
    }
211
212
    /**
213
     * @return null|string
214
     */
215
    public function getAttention()
216
    {
217
        return $this->attention;
218
    }
219
220
    /**
221
     * @param null|string $attention
222
     * @return Delivery
223
     */
224
    public function setAttention($attention)
225
    {
226
        $this->attention = $attention;
227
        return $this;
228
    }
229
230
    /**
231
     * @return null|string
232
     */
233
    public function getCity()
234
    {
235
        return $this->city;
236
    }
237
238
    /**
239
     * @param null|string $city
240
     * @return Delivery
241
     */
242
    public function setCity($city)
243
    {
244
        $this->city = $city;
245
        return $this;
246
    }
247
248
    /**
249
     * @return null|string
250
     */
251
    public function getCountry()
252
    {
253
        return $this->country;
254
    }
255
256
    /**
257
     * @param null|string $country
258
     * @return Delivery
259
     */
260
    public function setCountry($country)
261
    {
262
        $this->country = $country;
263
        return $this;
264
    }
265
266
    /**
267
     * @return int|null
268
     */
269
    public function getCountryId()
270
    {
271
        return $this->countryId;
272
    }
273
274
    /**
275
     * @param int|null $countryId
276
     * @return Delivery
277
     */
278
    public function setCountryId($countryId)
279
    {
280
        $this->countryId = $countryId;
281
        return $this;
282
    }
283
284
    /**
285
     * @return null|string
286
     */
287
    public function getCvr()
288
    {
289
        return $this->cvr;
290
    }
291
292
    /**
293
     * @param null|string $cvr
294
     * @return Delivery
295
     */
296
    public function setCvr($cvr)
297
    {
298
        $this->cvr = $cvr;
299
        return $this;
300
    }
301
302
    /**
303
     * @return null|string
304
     */
305
    public function getEan()
306
    {
307
        return $this->ean;
308
    }
309
310
    /**
311
     * @param null|string $ean
312
     * @return Delivery
313
     */
314
    public function setEan($ean)
315
    {
316
        $this->ean = $ean;
317
        return $this;
318
    }
319
320
    /**
321
     * @return null|string
322
     */
323
    public function getEmail()
324
    {
325
        return $this->email;
326
    }
327
328
    /**
329
     * @param null|string $email
330
     * @return Delivery
331
     */
332
    public function setEmail($email)
333
    {
334
        $this->email = $email;
335
        return $this;
336
    }
337
338
    /**
339
     * @return null|string
340
     */
341
    public function getFax()
342
    {
343
        return $this->fax;
344
    }
345
346
    /**
347
     * @param null|string $fax
348
     * @return Delivery
349
     */
350
    public function setFax($fax)
351
    {
352
        $this->fax = $fax;
353
        return $this;
354
    }
355
356
    /**
357
     * @return null|string
358
     */
359
    public function getName()
360
    {
361
        return $this->name;
362
    }
363
364
    /**
365
     * @param null|string $name
366
     * @return Delivery
367
     */
368
    public function setName($name)
369
    {
370
        $this->name = $name;
371
        return $this;
372
    }
373
374
    /**
375
     * @return null|string
376
     */
377
    public function getPhone()
378
    {
379
        return $this->phone;
380
    }
381
382
    /**
383
     * @param null|string $phone
384
     * @return Delivery
385
     */
386
    public function setPhone($phone)
387
    {
388
        $this->phone = $phone;
389
        return $this;
390
    }
391
392
    /**
393
     * @return null|string
394
     */
395
    public function getState()
396
    {
397
        return $this->state;
398
    }
399
400
    /**
401
     * @param null|string $state
402
     * @return Delivery
403
     */
404
    public function setState($state)
405
    {
406
        $this->state = $state;
407
        return $this;
408
    }
409
410
    /**
411
     * @return null|string
412
     */
413
    public function getZipCode()
414
    {
415
        return $this->zipCode;
416
    }
417
418
    /**
419
     * @param null|string $zipCode
420
     * @return Delivery
421
     */
422
    public function setZipCode($zipCode)
423
    {
424
        $this->zipCode = $zipCode;
425
        return $this;
426
    }
427
}
428