Completed
Push — master ( 69fb76...ff5317 )
by
unknown
04:59
created

EventCommandHandler::getSelectMainImageClassName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
4
namespace CultuurNet\UDB3\Event;
5
6
use CultuurNet\UDB3\Event\Commands\AddImage;
7
use CultuurNet\UDB3\Event\Commands\AddLabel;
8
use CultuurNet\UDB3\Event\Commands\DeleteEvent;
9
use CultuurNet\UDB3\Event\Commands\RemoveLabel;
10
use CultuurNet\UDB3\Event\Commands\Moderation\Approve;
11
use CultuurNet\UDB3\Event\Commands\Moderation\FlagAsDuplicate;
12
use CultuurNet\UDB3\Event\Commands\Moderation\FlagAsInappropriate;
13
use CultuurNet\UDB3\Event\Commands\Moderation\Publish;
14
use CultuurNet\UDB3\Event\Commands\Moderation\Reject;
15
use CultuurNet\UDB3\Event\Commands\RemoveImage;
16
use CultuurNet\UDB3\Event\Commands\DeleteOrganizer;
17
use CultuurNet\UDB3\Event\Commands\DeleteTypicalAgeRange;
18
use CultuurNet\UDB3\Event\Commands\SelectMainImage;
19
use CultuurNet\UDB3\Event\Commands\UpdateFacilities;
20
use CultuurNet\UDB3\Event\Commands\UpdateTheme;
21
use CultuurNet\UDB3\Event\Commands\UpdateTitle;
22
use CultuurNet\UDB3\Event\Commands\UpdateAudience;
23
use CultuurNet\UDB3\Event\Commands\UpdateBookingInfo;
24
use CultuurNet\UDB3\Event\Commands\UpdateCalendar;
25
use CultuurNet\UDB3\Event\Commands\UpdateContactPoint;
26
use CultuurNet\UDB3\Event\Commands\UpdateDescription;
27
use CultuurNet\UDB3\Event\Commands\UpdateImage;
28
use CultuurNet\UDB3\Event\Commands\UpdateLocation;
29
use CultuurNet\UDB3\Event\Commands\UpdateMajorInfo;
30
use CultuurNet\UDB3\Event\Commands\UpdateOrganizer;
31
use CultuurNet\UDB3\Event\Commands\UpdatePriceInfo;
32
use CultuurNet\UDB3\Event\Commands\UpdateType;
33
use CultuurNet\UDB3\Event\Commands\UpdateTypicalAgeRange;
34
use CultuurNet\UDB3\Offer\OfferCommandHandler;
35
use Psr\Log\LoggerAwareInterface;
36
use Psr\Log\LoggerAwareTrait;
37
38
/**
39
 * Commandhandler for events
40
 */
41
class EventCommandHandler extends OfferCommandHandler implements LoggerAwareInterface
42
{
43
    use LoggerAwareTrait;
44
45
    /**
46
     * Handle an update the major info command.
47
     * @param UpdateMajorInfo $updateMajorInfo
48
     */
49 View Code Duplication
    public function handleUpdateMajorInfo(UpdateMajorInfo $updateMajorInfo)
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...
50
    {
51
        /** @var Event $event */
52
        $event = $this->offerRepository->load($updateMajorInfo->getItemId());
53
54
        $event->updateMajorInfo(
55
            $updateMajorInfo->getTitle(),
56
            $updateMajorInfo->getEventType(),
57
            $updateMajorInfo->getLocation(),
58
            $updateMajorInfo->getCalendar(),
59
            $updateMajorInfo->getTheme()
60
        );
61
62
        $this->offerRepository->save($event);
63
64
    }
65
66
    /**
67
     * @param UpdateLocation $updateLocation
68
     */
69
    public function handleUpdateLocation(UpdateLocation $updateLocation)
70
    {
71
        /** @var Event $event */
72
        $event = $this->offerRepository->load($updateLocation->getItemId());
73
74
        $event->updateLocation($updateLocation->getLocationId());
75
76
        $this->offerRepository->save($event);
77
    }
78
79
    /**
80
     * @param UpdateAudience $updateAudience
81
     */
82
    public function handleUpdateAudience(UpdateAudience $updateAudience)
83
    {
84
        /** @var Event $event */
85
        $event = $this->offerRepository->load($updateAudience->getItemId());
86
87
        $event->updateAudience($updateAudience->getAudience());
88
89
        $this->offerRepository->save($event);
90
    }
91
92
    /**
93
     * @return string
94
     */
95
    protected function getAddLabelClassName()
96
    {
97
        return AddLabel::class;
98
    }
99
100
    /**
101
     * @return string
102
     */
103
    protected function getRemoveLabelClassName()
104
    {
105
        return RemoveLabel::class;
106
    }
107
108
    /**
109
     * @return string
110
     */
111
    protected function getAddImageClassName()
112
    {
113
        return AddImage::class;
114
    }
115
116
    /**
117
     * @return string
118
     */
119
    protected function getUpdateImageClassName()
120
    {
121
        return UpdateImage::class;
122
    }
123
124
    /**
125
     * @return string
126
     */
127
    protected function getRemoveImageClassName()
128
    {
129
        return RemoveImage::class;
130
    }
131
132
    /**
133
     * @return string
134
     */
135
    protected function getSelectMainImageClassName()
136
    {
137
        return SelectMainImage::class;
138
    }
139
140
    /**
141
     * @return string
142
     */
143
    protected function getUpdateTitleClassName()
144
    {
145
        return UpdateTitle::class;
146
    }
147
148
    /**
149
     * @return string
150
     */
151
    protected function getUpdateDescriptionClassName()
152
    {
153
        return UpdateDescription::class;
154
    }
155
156
    /**
157
     * @inheritdoc
158
     */
159
    protected function getUpdateCalendarClassName()
160
    {
161
        return UpdateCalendar::class;
162
    }
163
164
    /**
165
     * @return string
166
     */
167
    protected function getUpdateTypicalAgeRangeClassName()
168
    {
169
        return UpdateTypicalAgeRange::class;
170
    }
171
172
    /**
173
     * @return string
174
     */
175
    protected function getDeleteTypicalAgeRangeClassName()
176
    {
177
        return DeleteTypicalAgeRange::class;
178
    }
179
180
    /**
181
     * @return string
182
     */
183
    protected function getUpdateOrganizerClassName()
184
    {
185
        return UpdateOrganizer::class;
186
    }
187
188
    /**
189
     * @return string
190
     */
191
    protected function getDeleteOrganizerClassName()
192
    {
193
        return DeleteOrganizer::class;
194
    }
195
196
    /**
197
     * @return string
198
     */
199
    protected function getUpdateContactPointClassName()
200
    {
201
        return UpdateContactPoint::class;
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    protected function getUpdateBookingInfoClassName()
208
    {
209
        return UpdateBookingInfo::class;
210
    }
211
212
    /**
213
     * @return string
214
     */
215
    protected function getUpdatePriceInfoClassName()
216
    {
217
        return UpdatePriceInfo::class;
218
    }
219
220
    /**
221
     * @return string
222
     */
223
    protected function getDeleteOfferClassName()
224
    {
225
        return DeleteEvent::class;
226
    }
227
228
    protected function getPublishClassName()
229
    {
230
        return Publish::class;
231
    }
232
233
    protected function getApproveClassName()
234
    {
235
        return Approve::class;
236
    }
237
238
    protected function getRejectClassName()
239
    {
240
        return Reject::class;
241
    }
242
243
    protected function getFlagAsDuplicateClassName()
244
    {
245
        return FlagAsDuplicate::class;
246
    }
247
248
    protected function getFlagAsInappropriateClassName()
249
    {
250
        return FlagAsInappropriate::class;
251
    }
252
253
    /**
254
     * @inheritdoc
255
     */
256
    protected function getUpdateTypeClassName()
257
    {
258
        return UpdateType::class;
259
    }
260
261
    /**
262
     * @inheritdoc
263
     */
264
    protected function getUpdateThemeClassName()
265
    {
266
        return UpdateTheme::class;
267
    }
268
269
    /**
270
     * @inheritdoc
271
     */
272
    protected function getUpdateFacilitiesClassName()
273
    {
274
        return UpdateFacilities::class;
275
    }
276
}
277