Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 401-408 (lines=8) @@
398
        Location $location,
399
        ContactInformation $contactInformation
400
    ) {
401
        if ($this->raLocations->containsWithId($raLocationId)) {
402
            throw new DomainException(sprintf(
403
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
404
                . ' it is already present',
405
                $raLocationId,
406
                $this->getAggregateRootId()
407
            ));
408
        }
409
410
        $this->apply(new RaLocationAddedEvent(
411
            $this->institutionConfigurationId,
@@ 432-439 (lines=8) @@
429
        Location $location,
430
        ContactInformation $contactInformation
431
    ) {
432
        if (!$this->raLocations->containsWithId($raLocationId)) {
433
            throw new DomainException(sprintf(
434
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
435
                . ' it is not present',
436
                $raLocationId,
437
                $this->getAggregateRootId()
438
            ));
439
        }
440
441
        $raLocation = $this->raLocations->getById($raLocationId);
442
@@ 469-476 (lines=8) @@
466
     */
467
    public function removeRaLocation(RaLocationId $raLocationId)
468
    {
469
        if (!$this->raLocations->containsWithId($raLocationId)) {
470
            throw new DomainException(sprintf(
471
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
472
                . ' it is not present',
473
                $raLocationId,
474
                $this->getAggregateRootId()
475
            ));
476
        }
477
478
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
479
    }