Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 91-98 (lines=8) @@
88
        Location $location,
89
        ContactInformation $contactInformation
90
    ) {
91
        if ($this->raLocations->containsWithId($raLocationId)) {
92
            throw new DomainException(sprintf(
93
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
94
                . ' it is already present',
95
                $raLocationId,
96
                $this->getAggregateRootId()
97
            ));
98
        }
99
100
        $this->apply(new RaLocationAddedEvent(
101
            $this->institutionConfigurationId,
@@ 122-129 (lines=8) @@
119
        Location $location,
120
        ContactInformation $contactInformation
121
    ) {
122
        if (!$this->raLocations->containsWithId($raLocationId)) {
123
            throw new DomainException(sprintf(
124
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
125
                . ' it is not present',
126
                $raLocationId,
127
                $this->getAggregateRootId()
128
            ));
129
        }
130
131
        $raLocation = $this->raLocations->getById($raLocationId);
132
@@ 159-166 (lines=8) @@
156
     */
157
    public function removeRaLocation(RaLocationId $raLocationId)
158
    {
159
        if (!$this->raLocations->containsWithId($raLocationId)) {
160
            throw new DomainException(sprintf(
161
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
162
                . ' it is not present',
163
                $raLocationId,
164
                $this->getAggregateRootId()
165
            ));
166
        }
167
168
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
169
    }