Code Duplication    Length = 11-12 lines in 2 locations

src/Surfnet/StepupGateway/SecondFactorOnlyBundle/Controller/SecondFactorOnlyController.php 2 locations

@@ 192-202 (lines=11) @@
189
        $loaResolutionService = $this->get('surfnet_stepup.service.loa_resolution');
190
        $loa = $loaResolutionService->getLoa($authnContextClassRef);
191
192
        if (!$loa) {
193
            $logger->info(sprintf(
194
              'Requested required Loa "%s" does not exist,'
195
              .' sending response with status Requester Error',
196
              $authnContextClassRef
197
            ));
198
            $responseRendering = $this->get('gateway.service.saml_response');
199
            return $responseRendering->renderRequesterFailureResponse(
200
              $this->get(static::RESPONSE_CONTEXT_SERVICE_ID)
201
            );
202
        }
203
204
        $expectedContextClass = $loa->fetchAuthnContextClassOfType(
205
          AuthnContextClass::TYPE_SECOND_FACTOR_ONLY
@@ 208-219 (lines=12) @@
205
          AuthnContextClass::TYPE_SECOND_FACTOR_ONLY
206
        );
207
208
        if (!$expectedContextClass || !$expectedContextClass->isIdentifiedBy($authnContextClassRef)) {
209
            $logger->info(sprintf(
210
              'Requested required Loa "%s" does is of the wrong type!'
211
              . ' Please use second-factor-only AuthnContextClassRefs.'
212
              . ' Sending response with status Requester Error',
213
              $authnContextClassRef
214
            ));
215
            $responseRendering = $this->get('gateway.service.saml_response');
216
            return $responseRendering->renderRequesterFailureResponse(
217
              $this->get(static::RESPONSE_CONTEXT_SERVICE_ID)
218
            );
219
        }
220
    }
221
}
222