Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 336-343 (lines=8) @@
333
        Location $location,
334
        ContactInformation $contactInformation
335
    ) {
336
        if ($this->raLocations->containsWithId($raLocationId)) {
337
            throw new DomainException(sprintf(
338
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
339
                . ' it is already present',
340
                $raLocationId,
341
                $this->getAggregateRootId()
342
            ));
343
        }
344
345
        $this->apply(new RaLocationAddedEvent(
346
            $this->institutionConfigurationId,
@@ 367-374 (lines=8) @@
364
        Location $location,
365
        ContactInformation $contactInformation
366
    ) {
367
        if (!$this->raLocations->containsWithId($raLocationId)) {
368
            throw new DomainException(sprintf(
369
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
370
                . ' it is not present',
371
                $raLocationId,
372
                $this->getAggregateRootId()
373
            ));
374
        }
375
376
        $raLocation = $this->raLocations->getById($raLocationId);
377
@@ 404-411 (lines=8) @@
401
     */
402
    public function removeRaLocation(RaLocationId $raLocationId)
403
    {
404
        if (!$this->raLocations->containsWithId($raLocationId)) {
405
            throw new DomainException(sprintf(
406
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
407
                . ' it is not present',
408
                $raLocationId,
409
                $this->getAggregateRootId()
410
            ));
411
        }
412
413
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
414
    }