Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 154-161 (lines=8) @@
151
        Location $location,
152
        ContactInformation $contactInformation
153
    ) {
154
        if ($this->raLocations->containsWithId($raLocationId)) {
155
            throw new DomainException(sprintf(
156
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
157
                . ' it is already present',
158
                $raLocationId,
159
                $this->getAggregateRootId()
160
            ));
161
        }
162
163
        $this->apply(new RaLocationAddedEvent(
164
            $this->institutionConfigurationId,
@@ 185-192 (lines=8) @@
182
        Location $location,
183
        ContactInformation $contactInformation
184
    ) {
185
        if (!$this->raLocations->containsWithId($raLocationId)) {
186
            throw new DomainException(sprintf(
187
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
188
                . ' it is not present',
189
                $raLocationId,
190
                $this->getAggregateRootId()
191
            ));
192
        }
193
194
        $raLocation = $this->raLocations->getById($raLocationId);
195
@@ 222-229 (lines=8) @@
219
     */
220
    public function removeRaLocation(RaLocationId $raLocationId)
221
    {
222
        if (!$this->raLocations->containsWithId($raLocationId)) {
223
            throw new DomainException(sprintf(
224
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
225
                . ' it is not present',
226
                $raLocationId,
227
                $this->getAggregateRootId()
228
            ));
229
        }
230
231
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
232
    }