Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 326-333 (lines=8) @@
323
        Location $location,
324
        ContactInformation $contactInformation
325
    ) {
326
        if ($this->raLocations->containsWithId($raLocationId)) {
327
            throw new DomainException(sprintf(
328
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
329
                . ' it is already present',
330
                $raLocationId,
331
                $this->getAggregateRootId()
332
            ));
333
        }
334
335
        $this->apply(new RaLocationAddedEvent(
336
            $this->institutionConfigurationId,
@@ 357-364 (lines=8) @@
354
        Location $location,
355
        ContactInformation $contactInformation
356
    ) {
357
        if (!$this->raLocations->containsWithId($raLocationId)) {
358
            throw new DomainException(sprintf(
359
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
360
                . ' it is not present',
361
                $raLocationId,
362
                $this->getAggregateRootId()
363
            ));
364
        }
365
366
        $raLocation = $this->raLocations->getById($raLocationId);
367
@@ 394-401 (lines=8) @@
391
     */
392
    public function removeRaLocation(RaLocationId $raLocationId)
393
    {
394
        if (!$this->raLocations->containsWithId($raLocationId)) {
395
            throw new DomainException(sprintf(
396
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
397
                . ' it is not present',
398
                $raLocationId,
399
                $this->getAggregateRootId()
400
            ));
401
        }
402
403
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
404
    }