Completed
Pull Request — master (#314)
by Luc
04:56
created

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