Code Duplication    Length = 8-8 lines in 3 locations

src/Surfnet/Stepup/Configuration/InstitutionConfiguration.php 3 locations

@@ 208-215 (lines=8) @@
205
        Location $location,
206
        ContactInformation $contactInformation
207
    ) {
208
        if ($this->raLocations->containsWithId($raLocationId)) {
209
            throw new DomainException(sprintf(
210
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
211
                . ' it is already present',
212
                $raLocationId,
213
                $this->getAggregateRootId()
214
            ));
215
        }
216
217
        $this->apply(new RaLocationAddedEvent(
218
            $this->institutionConfigurationId,
@@ 239-246 (lines=8) @@
236
        Location $location,
237
        ContactInformation $contactInformation
238
    ) {
239
        if (!$this->raLocations->containsWithId($raLocationId)) {
240
            throw new DomainException(sprintf(
241
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
242
                . ' it is not present',
243
                $raLocationId,
244
                $this->getAggregateRootId()
245
            ));
246
        }
247
248
        $raLocation = $this->raLocations->getById($raLocationId);
249
@@ 276-283 (lines=8) @@
273
     */
274
    public function removeRaLocation(RaLocationId $raLocationId)
275
    {
276
        if (!$this->raLocations->containsWithId($raLocationId)) {
277
            throw new DomainException(sprintf(
278
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
279
                . ' it is not present',
280
                $raLocationId,
281
                $this->getAggregateRootId()
282
            ));
283
        }
284
285
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
286
    }