Code Duplication    Length = 12-21 lines in 3 locations

src/Organizer/Organizer.php 2 locations

@@ 177-197 (lines=21) @@
174
     * @param Title $title
175
     * @param Language $language
176
     */
177
    public function updateTitle(
178
        Title $title,
179
        Language $language
180
    ) {
181
        if ($this->isTitleChanged($title, $language)) {
182
            if ($language->getCode() !== $this->mainLanguage->getCode()) {
183
                $event = new TitleTranslated(
184
                    $this->actorId,
185
                    $title,
186
                    $language
187
                );
188
            } else {
189
                $event = new TitleUpdated(
190
                    $this->actorId,
191
                    $title
192
                );
193
            }
194
195
            $this->apply($event);
196
        }
197
    }
198
199
    /**
200
     * @param Address $address
@@ 203-223 (lines=21) @@
200
     * @param Address $address
201
     * @param Language $language
202
     */
203
    public function updateAddress(
204
        Address $address,
205
        Language $language
206
    ) {
207
        if ($this->isAddressChanged($address, $language)) {
208
            if ($language->getCode() !== $this->mainLanguage->getCode()) {
209
                $event = new AddressTranslated(
210
                    $this->actorId,
211
                    $address,
212
                    $language
213
                );
214
            } else {
215
                $event = new AddressUpdated(
216
                    $this->actorId,
217
                    $address
218
                );
219
            }
220
221
            $this->apply($event);
222
        }
223
    }
224
225
    /**
226
     * @param ContactPoint $contactPoint

src/Place/Place.php 1 location

@@ 196-207 (lines=12) @@
193
     * @param Address $address
194
     * @param Language $language
195
     */
196
    public function updateAddress(Address $address, Language $language)
197
    {
198
        if ($language->getCode() === $this->mainLanguage->getCode()) {
199
            $event = new AddressUpdated($this->placeId, $address);
200
        } else {
201
            $event = new AddressTranslated($this->placeId, $address, $language);
202
        }
203
204
        if ($this->allowAddressUpdate($address, $language)) {
205
            $this->apply($event);
206
        }
207
    }
208
209
    /**
210
     * @param AddressUpdated $addressUpdated