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

CommandHandler::handleUpdateFacilities()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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