Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 171-178 (lines=8) @@
168
        Location $location,
169
        ContactInformation $contactInformation
170
    ) {
171
        if ($this->raLocations->containsWithId($raLocationId)) {
172
            throw new DomainException(sprintf(
173
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
174
                . ' it is already present',
175
                $raLocationId,
176
                $this->getAggregateRootId()
177
            ));
178
        }
179
180
        $this->apply(new RaLocationAddedEvent(
181
            $this->institutionConfigurationId,
@@ 202-209 (lines=8) @@
199
        Location $location,
200
        ContactInformation $contactInformation
201
    ) {
202
        if (!$this->raLocations->containsWithId($raLocationId)) {
203
            throw new DomainException(sprintf(
204
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
205
                . ' it is not present',
206
                $raLocationId,
207
                $this->getAggregateRootId()
208
            ));
209
        }
210
211
        $raLocation = $this->raLocations->getById($raLocationId);
212
@@ 239-246 (lines=8) @@
236
     */
237
    public function removeRaLocation(RaLocationId $raLocationId)
238
    {
239
        if (!$this->raLocations->containsWithId($raLocationId)) {
240
            throw new DomainException(sprintf(
241
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
242
                . ' it is not present',
243
                $raLocationId,
244
                $this->getAggregateRootId()
245
            ));
246
        }
247
248
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
249
    }