CoreFiles by mySites.guru
AttestationStatementSupportManager.php41 lines, 1,061 bytes, from Joomla_5.2.3-Stable-Full_Package.zip
Raw History Compare with 5.2.2
md5
3d86dba76947374dd76c996a050b8d00
sha1
3d9cf763132edd3211cc42cc1565ad6209e23896
sha256
ac852f0760b5727032ecf26097edfeee18c7ddd35c0cf825b8308214f4517c6a
<?php

declare(strict_types=1);

namespace Webauthn\AttestationStatement;

use function array_key_exists;
use Webauthn\Exception\InvalidDataException;

class AttestationStatementSupportManager
{
    /**
     * @var AttestationStatementSupport[]
     */
    private array $attestationStatementSupports = [];

    public static function create(): self
    {
        return new self();
    }

    public function add(AttestationStatementSupport $attestationStatementSupport): void
    {
        $this->attestationStatementSupports[$attestationStatementSupport->name()] = $attestationStatementSupport;
    }

    public function has(string $name): bool
    {
        return array_key_exists($name, $this->attestationStatementSupports);
    }

    public function get(string $name): AttestationStatementSupport
    {
        $this->has($name) || throw InvalidDataException::create($name, sprintf(
            'The attestation statement format "%s" is not supported.',
            $name
        ));

        return $this->attestationStatementSupports[$name];
    }
}

The same content is in 158 releases, Joomla 5.0.0-alpha1 to 6.3.0-alpha1. See them all, or every version of this file.