Completed
Pull Request — master (#350)
by
unknown
05:43
created

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