for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Surfnet\StepupGateway\GatewayBundle\Service;
use Surfnet\StepupBundle\Value\Loa;
use Surfnet\StepupGateway\GatewayBundle\Exception\InvalidArgumentException;
final class AuthnContextClassRefLookupService
{
/**
* @var array<string,string>
*/
private $loaAuthnContextClassMapping;
* @param array<string,string> $loaAuthnContextClassMapping
public function __construct(array $loaAuthnContextClassMapping)
foreach ($loaAuthnContextClassMapping as $loaId => $authnContextClassRef) {
if (!is_string($loaId)) {
throw InvalidArgumentException::invalidType(
'string',
'authnContextClassRef',
$authnContextClassRef
);
}
if (!is_string($authnContextClassRef)) {
'ref',
$this->loaAuthnContextClassMapping = $loaAuthnContextClassMapping;
* @param string $authnContextClassRef
* @return string|bool
public function findLoaIdByAuthnContextClassRef($authnContextClassRef)
return array_search($authnContextClassRef, $this->loaAuthnContextClassMapping);
* @param Loa $loa
public function findAuthnContextClassRefByLoa(Loa $loa)
foreach ($this->loaAuthnContextClassMapping as $loaId => $ref) {
if ($loa->isIdentifiedBy($loaId)) {
return $ref;
return false;