Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 144-151 (lines=8) @@
141
        Location $location,
142
        ContactInformation $contactInformation
143
    ) {
144
        if ($this->raLocations->containsWithId($raLocationId)) {
145
            throw new DomainException(sprintf(
146
                'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":'
147
                . ' it is already present',
148
                $raLocationId,
149
                $this->getAggregateRootId()
150
            ));
151
        }
152
153
        $this->apply(new RaLocationAddedEvent(
154
            $this->institutionConfigurationId,
@@ 175-182 (lines=8) @@
172
        Location $location,
173
        ContactInformation $contactInformation
174
    ) {
175
        if (!$this->raLocations->containsWithId($raLocationId)) {
176
            throw new DomainException(sprintf(
177
                'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
178
                . ' it is not present',
179
                $raLocationId,
180
                $this->getAggregateRootId()
181
            ));
182
        }
183
184
        $raLocation = $this->raLocations->getById($raLocationId);
185
@@ 212-219 (lines=8) @@
209
     */
210
    public function removeRaLocation(RaLocationId $raLocationId)
211
    {
212
        if (!$this->raLocations->containsWithId($raLocationId)) {
213
            throw new DomainException(sprintf(
214
                'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":'
215
                . ' it is not present',
216
                $raLocationId,
217
                $this->getAggregateRootId()
218
            ));
219
        }
220
221
        $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId));
222
    }