Completed
Push — master ( ca4bd4...d89b8a )
by Mauro
03:26
created

Ad::setCity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/*
3
 * This file is part of the La Voz Feed Generator package.
4
 *
5
 * (c) Zephia <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Zephia\LaVozFeed\Entity;
12
use Zephia\LaVozFeed\Exception\LogicException;
13
14
/**
15
 * Class Ad
16
 *
17
 * @package Zephia\LaVozFeed\Entity
18
 * @author  Mauro Moreno <[email protected]>
19
 */
20
class Ad extends Entity
21
{
22
    /**
23
     * @var string
24
     */
25
    private $id = '';
26
27
    /**
28
     * @var string
29
     */
30
    private $city = '';
31
32
    /**
33
     * @var string
34
     */
35
    private $content = '';
36
37
    /**
38
     * @var District
39
     */
40
    private $district;
41
42
    /**
43
     * @var Email
44
     */
45
    private $email;
46
47
    /**
48
     * @var \DateTime
49
     */
50
    private $modify;
51
52
    /**
53
     * @var string
54
     */
55
    private $operation = '';
56
57
    /**
58
     * @var string
59
     */
60
    private $payment = '';
61
62
    /**
63
     * @var Phone
64
     */
65
    private $phone;
66
67
    /**
68
     * @var array
69
     */
70
    private $pictures = [];
71
72
    /**
73
     * @var Price
74
     */
75
    private $price;
76
77
    /**
78
     * @var string
79
     */
80
    private $region = '';
81
82
    /**
83
     * @var string
84
     */
85
    private $status = '';
86
87
    /**
88
     * @var string
89
     */
90
    private $title = '';
91
92
    /**
93
     * @var string
94
     */
95
    private $type = '';
96
97
    /**
98
     * Get Id
99
     *
100
     * @return string
101
     */
102
    public function getId()
103
    {
104
        if (empty($this->id)) {
105
            throw new LogicException(
106
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'id')
107
            );
108
        }
109
        return $this->id;
110
    }
111
112
    /**
113
     * Set Id
114
     *
115
     * @param string $id
116
     *
117
     * @return Ad
118
     */
119
    public function setId($id)
120
    {
121
        $this->id = $id;
122
        return $this;
123
    }
124
125
    /**
126
     * Get City
127
     *
128
     * @return string
129
     */
130
    public function getCity()
131
    {
132
        if (empty($this->city)) {
133
            throw new LogicException(
134
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'city')
135
            );
136
        }
137
        return $this->city;
138
    }
139
140
    /**
141
     * Set City
142
     *
143
     * @param string $city
144
     *
145
     * @return Ad
146
     */
147
    public function setCity($city)
148
    {
149
        $this->city = $city;
150
        return $this;
151
    }
152
153
    /**
154
     * Get Content
155
     *
156
     * @return string
157
     */
158
    public function getContent()
159
    {
160
        if (empty($this->content)) {
161
            throw new LogicException(
162
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'content')
163
            );
164
        }
165
        return $this->content;
166
    }
167
168
    /**
169
     * Set Content
170
     *
171
     * @param string $content
172
     *
173
     * @return Ad
174
     */
175
    public function setContent($content)
176
    {
177
        $this->content = $content;
178
        return $this;
179
    }
180
181
    /**
182
     * Get Email
183
     *
184
     * @return string
185
     */
186
    public function getEmail()
187
    {
188
        if (empty($this->email)) {
189
            throw new LogicException(
190
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'email')
191
            );
192
        }
193
        return $this->email;
194
    }
195
196
    /**
197
     * Set Email
198
     *
199
     * @param Email $email
200
     *
201
     * @return Ad
202
     */
203
    public function setEmail(Email $email)
204
    {
205
        $this->email = $email;
206
        return $this;
207
    }
208
209
    /**
210
     * Get District
211
     *
212
     * @return District
213
     */
214
    public function getDistrict()
215
    {
216
        return $this->district;
217
    }
218
219
    /**
220
     * Set District
221
     *
222
     * @param District $district
223
     *
224
     * @return Ad
225
     */
226
    public function setDistrict(District $district)
227
    {
228
        $this->district = $district;
229
        return $this;
230
    }
231
232
    /**
233
     * Get Modify
234
     *
235
     * @return \DateTime
236
     */
237
    public function getModify()
238
    {
239
        if (empty($this->modify)) {
240
            throw new LogicException(
241
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'modify')
242
            );
243
        }
244
        return $this->modify;
245
    }
246
247
    /**
248
     * Set Modify
249
     *
250
     * @param \DateTime $modify
251
     *
252
     * @return Ad
253
     */
254
    public function setModify($modify)
255
    {
256
        $this->modify = $modify;
257
        return $this;
258
    }
259
260
    /**
261
     * Get Operation
262
     *
263
     * @return string
264
     */
265
    public function getOperation()
266
    {
267
        if (empty($this->operation)) {
268
            throw new LogicException(
269
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'operation')
270
            );
271
        }
272
        return $this->operation;
273
    }
274
275
    /**
276
     * Set Operation
277
     *
278
     * @param string $operation
279
     *
280
     * @return Ad
281
     */
282
    public function setOperation($operation)
283
    {
284
        $this->operation = $operation;
285
        return $this;
286
    }
287
288
    /**
289
     * Set Payment
290
     *
291
     * @param string $payment
292
     *
293
     * @return Ad
294
     */
295
    public function setPayment(string $payment)
296
    {
297
        $this->payment = $payment;
298
        return $this;
299
    }
300
301
    /**
302
     * Get Payment
303
     *
304
     * @return string
305
     */
306
    public function getPayment()
307
    {
308
        return $this->payment;
309
    }
310
311
    /**
312
     * Get Phone
313
     *
314
     * @return Phone
315
     */
316
    public function getPhone()
317
    {
318
        if (empty($this->phone)) {
319
            throw new LogicException(
320
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'phone')
321
            );
322
        }
323
        return $this->phone;
324
    }
325
326
    /**
327
     * Set Phone
328
     *
329
     * @param Phone $phone
330
     *
331
     * @return Ad
332
     */
333
    public function setPhone(Phone $phone)
334
    {
335
        $this->phone = $phone;
336
        return $this;
337
    }
338
339
    /**
340
     * Add Picture
341
     *
342
     * @param Picture $picture
343
     *
344
     * @return Ad
345
     */
346
    public function addPicture(Picture $picture)
347
    {
348
        $this->pictures[] = $picture;
349
        return $this;
350
    }
351
352
    /**
353
     * Get Pictures
354
     *
355
     * @return array
356
     */
357
    public function getPictures()
358
    {
359
        if (count($this->pictures) === 0) {
360
            throw new LogicException(
361
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'pictures')
362
            );
363
        }
364
        return $this->pictures;
365
    }
366
367
    /**
368
     * Set Pictures
369
     *
370
     * @param array $pictures
371
     *
372
     * @return Ad
373
     */
374
    public function setPictures($pictures)
375
    {
376
        $this->pictures = $pictures;
377
        return $this;
378
    }
379
380
    /**
381
     * Get Price
382
     *
383
     * @return Price
384
     */
385
    public function getPrice()
386
    {
387
        if (empty($this->price)) {
388
            throw new LogicException(
389
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'price')
390
            );
391
        }
392
        return $this->price;
393
    }
394
395
    /**
396
     * Set Price
397
     *
398
     * @param Price $price
399
     *
400
     * @return Ad
401
     */
402
    public function setPrice($price)
403
    {
404
        $this->price = $price;
405
        return $this;
406
    }
407
408
    /**
409
     * Get Region
410
     *
411
     * @return string
412
     */
413
    public function getRegion()
414
    {
415
        if (empty($this->region)) {
416
            throw new LogicException(
417
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'region')
418
            );
419
        }
420
        return $this->region;
421
    }
422
423
    /**
424
     * Set Region
425
     *
426
     * @param string $region
427
     *
428
     * @return Ad
429
     */
430
    public function setRegion($region)
431
    {
432
        $this->region = $region;
433
        return $this;
434
    }
435
436
    /**
437
     * Get Status
438
     *
439
     * @return string
440
     */
441
    public function getStatus()
442
    {
443
        if (empty($this->status)) {
444
            throw new LogicException(
445
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'status')
446
            );
447
        }
448
        return $this->status;
449
    }
450
451
    /**
452
     * Set Status
453
     *
454
     * @param string $status
455
     *
456
     * @return Ad
457
     */
458
    public function setStatus($status)
459
    {
460
        $this->status = $status;
461
        return $this;
462
    }
463
464
    /**
465
     * Get Title
466
     *
467
     * @return string
468
     */
469
    public function getTitle()
470
    {
471
        if (empty($this->title)) {
472
            throw new LogicException(
473
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'title')
474
            );
475
        }
476
        return $this->title;
477
    }
478
479
    /**
480
     * Set Title
481
     *
482
     * @param string $title
483
     *
484
     * @return Ad
485
     */
486
    public function setTitle($title)
487
    {
488
        $this->title = $title;
489
        return $this;
490
    }
491
492
    /**
493
     * Get Type
494
     *
495
     * @return string
496
     */
497
    public function getType()
498
    {
499
        if (empty($this->type)) {
500
            throw new LogicException(
501
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'type')
502
            );
503
        }
504
        return $this->type;
505
    }
506
507
    /**
508
     * Set Type
509
     *
510
     * @param string $type
511
     *
512
     * @return Ad
513
     */
514
    public function setType($type)
515
    {
516
        $this->type = $type;
517
        return $this;
518
    }
519
}
520