Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 378-385 (lines=8) @@
375
        Location $location,
376
        ContactInformation $contactInformation
377
    ) {
378
        if ($this->raLocations->containsWithId($raLocationId)) {
379
            throw new DomainException(sprintf(
380
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
381
                . ' it is already present',
382
                $raLocationId,
383
                $this->getAggregateRootId()
384
            ));
385
        }
386
387
        $this->apply(new RaLocationAddedEvent(
388
            $this->institutionConfigurationId,
@@ 409-416 (lines=8) @@
406
        Location $location,
407
        ContactInformation $contactInformation
408
    ) {
409
        if (!$this->raLocations->containsWithId($raLocationId)) {
410
            throw new DomainException(sprintf(
411
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
412
                . ' it is not present',
413
                $raLocationId,
414
                $this->getAggregateRootId()
415
            ));
416
        }
417
418
        $raLocation = $this->raLocations->getById($raLocationId);
419
@@ 446-453 (lines=8) @@
443
     */
444
    public function removeRaLocation(RaLocationId $raLocationId)
445
    {
446
        if (!$this->raLocations->containsWithId($raLocationId)) {
447
            throw new DomainException(sprintf(
448
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
449
                . ' it is not present',
450
                $raLocationId,
451
                $this->getAggregateRootId()
452
            ));
453
        }
454
455
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
456
    }