Completed
Pull Request — master (#352)
by
unknown
04:54
created

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