Code Duplication    Length = 12-21 lines in 2 locations

src/Organizer/Organizer.php 1 location

@@ 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

@@ 168-179 (lines=12) @@
165
        $this->addresses[$this->mainLanguage->getCode()] = $majorInfoUpdated->getAddress();
166
    }
167
168
    public function updateAddress(Address $address, Language $language): void
169
    {
170
        if ($language->getCode() === $this->mainLanguage->getCode()) {
171
            $event = new AddressUpdated($this->placeId, $address);
172
        } else {
173
            $event = new AddressTranslated($this->placeId, $address, $language);
174
        }
175
176
        if ($this->allowAddressUpdate($address, $language)) {
177
            $this->apply($event);
178
        }
179
    }
180
181
    protected function applyAddressUpdated(AddressUpdated $addressUpdated): void
182
    {