Completed
Pull Request — master (#322)
by Luc
05:07
created

EventCommandHandler::getUpdateCalendarClassName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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