Completed
Pull Request — master (#261)
by Luc
08:13 queued 03:00
created

EventCommandHandler::handleUpdateAudience()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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