Code Duplication    Length = 18-18 lines in 2 locations

src/Surfnet/StepupMiddleware/ApiBundle/Identity/Projector/RaListingProjector.php 2 locations

@@ 107-124 (lines=18) @@
104
        $this->raListingRepository->save($raListing);
105
    }
106
107
    public function applyRegistrationAuthorityInformationAmendedForInstitutionEvent(
108
        RegistrationAuthorityInformationAmendedForInstitutionEvent $event
109
    ) {
110
        /** @var RaListing $raListing */
111
        $raListing = $this->raListingRepository->findByIdentityIdAndInstitution($event->identityId, $event->raInstitution);
112
113
        if (!$raListing) {
114
            throw new RuntimeException(
115
                "Tried to amend an RaListing's registration authority location and contact information, " .
116
                "but the listing could not be found"
117
            );
118
        }
119
120
        $raListing->location = $event->location;
121
        $raListing->contactInformation = $event->contactInformation;
122
123
        $this->raListingRepository->save($raListing);
124
    }
125
126
    public function applyAppointedAsRaForInstitutionEvent(AppointedAsRaForInstitutionEvent $event)
127
    {
@@ 210-227 (lines=18) @@
207
     *
208
     * @param RegistrationAuthorityInformationAmendedEvent $event
209
     */
210
    public function applyRegistrationAuthorityInformationAmendedEvent(
211
        RegistrationAuthorityInformationAmendedEvent $event
212
    ) {
213
        /** @var RaListing $raListing */
214
        $raListing = $this->raListingRepository->findByIdentityIdAndInstitution($event->identityId, $event->identityInstitution);
215
216
        if (!$raListing) {
217
            throw new RuntimeException(
218
                "Tried to amend an RaListing's registration authority location and contact information, " .
219
                "but the listing could not be found"
220
            );
221
        }
222
223
        $raListing->location = $event->location;
224
        $raListing->contactInformation = $event->contactInformation;
225
226
        $this->raListingRepository->save($raListing);
227
    }
228
229
    /**
230
     * This method is kept to be backwards compatible for changes before FGA