Code Duplication    Length = 8-8 lines in 3 locations

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

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