Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 332-339 (lines=8) @@
329
        Location $location,
330
        ContactInformation $contactInformation
331
    ) {
332
        if ($this->raLocations->containsWithId($raLocationId)) {
333
            throw new DomainException(sprintf(
334
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
335
                . ' it is already present',
336
                $raLocationId,
337
                $this->getAggregateRootId()
338
            ));
339
        }
340
341
        $this->apply(new RaLocationAddedEvent(
342
            $this->institutionConfigurationId,
@@ 363-370 (lines=8) @@
360
        Location $location,
361
        ContactInformation $contactInformation
362
    ) {
363
        if (!$this->raLocations->containsWithId($raLocationId)) {
364
            throw new DomainException(sprintf(
365
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
366
                . ' it is not present',
367
                $raLocationId,
368
                $this->getAggregateRootId()
369
            ));
370
        }
371
372
        $raLocation = $this->raLocations->getById($raLocationId);
373
@@ 400-407 (lines=8) @@
397
     */
398
    public function removeRaLocation(RaLocationId $raLocationId)
399
    {
400
        if (!$this->raLocations->containsWithId($raLocationId)) {
401
            throw new DomainException(sprintf(
402
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
403
                . ' it is not present',
404
                $raLocationId,
405
                $this->getAggregateRootId()
406
            ));
407
        }
408
409
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
410
    }