1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace CultuurNet\UDB3\Place\Events; |
4
|
|
|
|
5
|
|
|
use CultuurNet\UDB3\Address\Address; |
6
|
|
|
use CultuurNet\UDB3\Calendar; |
7
|
|
|
use CultuurNet\UDB3\Event\EventType; |
8
|
|
|
use CultuurNet\UDB3\Language; |
9
|
|
|
use CultuurNet\UDB3\Offer\Commands\AbstractCreateCommand; |
10
|
|
|
use CultuurNet\UDB3\Theme; |
11
|
|
|
use CultuurNet\UDB3\Title; |
12
|
|
|
use DateTimeImmutable; |
13
|
|
|
|
14
|
|
View Code Duplication |
class CreatePlace extends AbstractCreateCommand |
|
|
|
|
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @var Language |
18
|
|
|
*/ |
19
|
|
|
private $mainLanguage; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var Title |
23
|
|
|
*/ |
24
|
|
|
private $title; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var EventType |
28
|
|
|
*/ |
29
|
|
|
private $eventType; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var Theme |
33
|
|
|
*/ |
34
|
|
|
private $theme = null; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var Address |
38
|
|
|
*/ |
39
|
|
|
private $address; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var Calendar |
43
|
|
|
*/ |
44
|
|
|
private $calendar; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var DateTimeImmutable|null |
48
|
|
|
*/ |
49
|
|
|
private $publicationDate = null; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param string $eventId |
53
|
|
|
* @param Language $mainLanguage |
54
|
|
|
* @param Title $title |
55
|
|
|
* @param EventType $eventType |
56
|
|
|
* @param Address $address |
57
|
|
|
* @param Calendar $calendar |
58
|
|
|
* @param Theme|null $theme |
59
|
|
|
* @param DateTimeImmutable|null $publicationDate |
60
|
|
|
*/ |
61
|
|
|
public function __construct( |
62
|
|
|
$eventId, |
63
|
|
|
Language $mainLanguage, |
64
|
|
|
Title $title, |
65
|
|
|
EventType $eventType, |
66
|
|
|
Address $address, |
67
|
|
|
Calendar $calendar, |
68
|
|
|
Theme $theme = null, |
69
|
|
|
DateTimeImmutable $publicationDate = null |
70
|
|
|
) { |
71
|
|
|
parent::__construct($eventId); |
72
|
|
|
|
73
|
|
|
$this->mainLanguage = $mainLanguage; |
74
|
|
|
$this->title = $title; |
75
|
|
|
$this->eventType = $eventType; |
76
|
|
|
$this->address = $address; |
77
|
|
|
$this->calendar = $calendar; |
78
|
|
|
$this->theme = $theme; |
79
|
|
|
$this->publicationDate = $publicationDate; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return Language |
84
|
|
|
*/ |
85
|
|
|
public function getMainLanguage() |
86
|
|
|
{ |
87
|
|
|
return $this->mainLanguage; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return Title |
92
|
|
|
*/ |
93
|
|
|
public function getTitle() |
94
|
|
|
{ |
95
|
|
|
return $this->title; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return EventType |
100
|
|
|
*/ |
101
|
|
|
public function getEventType() |
102
|
|
|
{ |
103
|
|
|
return $this->eventType; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return Theme |
108
|
|
|
*/ |
109
|
|
|
public function getTheme() |
110
|
|
|
{ |
111
|
|
|
return $this->theme; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @return Calendar |
116
|
|
|
*/ |
117
|
|
|
public function getCalendar() |
118
|
|
|
{ |
119
|
|
|
return $this->calendar; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return Address |
124
|
|
|
*/ |
125
|
|
|
public function getAddress() |
126
|
|
|
{ |
127
|
|
|
return $this->address; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return DateTimeImmutable|null |
132
|
|
|
*/ |
133
|
|
|
public function getPublicationDate() |
134
|
|
|
{ |
135
|
|
|
return $this->publicationDate; |
136
|
|
|
} |
137
|
|
|
} |
138
|
|
|
|
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.