Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 227-234 (lines=8) @@
224
        Location $location,
225
        ContactInformation $contactInformation
226
    ) {
227
        if ($this->raLocations->containsWithId($raLocationId)) {
228
            throw new DomainException(sprintf(
229
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
230
                . ' it is already present',
231
                $raLocationId,
232
                $this->getAggregateRootId()
233
            ));
234
        }
235
236
        $this->apply(new RaLocationAddedEvent(
237
            $this->institutionConfigurationId,
@@ 258-265 (lines=8) @@
255
        Location $location,
256
        ContactInformation $contactInformation
257
    ) {
258
        if (!$this->raLocations->containsWithId($raLocationId)) {
259
            throw new DomainException(sprintf(
260
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
261
                . ' it is not present',
262
                $raLocationId,
263
                $this->getAggregateRootId()
264
            ));
265
        }
266
267
        $raLocation = $this->raLocations->getById($raLocationId);
268
@@ 295-302 (lines=8) @@
292
     */
293
    public function removeRaLocation(RaLocationId $raLocationId)
294
    {
295
        if (!$this->raLocations->containsWithId($raLocationId)) {
296
            throw new DomainException(sprintf(
297
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
298
                . ' it is not present',
299
                $raLocationId,
300
                $this->getAggregateRootId()
301
            ));
302
        }
303
304
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
305
    }