Debian Codegraph @

lib/3rdParty/composer/web-auth/webauthn-lib/src/MetadataService/Statement/ExtensionDescriptor.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Webauthn\MetadataService\Statement;
6
7 use Symfony\Component\Serializer\Attribute\SerializedName;
8 use Webauthn\Exception\MetadataStatementLoadingException;
9
10 readonly class ExtensionDescriptor
11 {
12 public function __construct(
13 public string $id,
14 public ?int $tag,
15 public ?string $data,
16 #[SerializedName('fail_if_unknown')]
17 public bool $failIfUnknown
18 ) {
19 if ($tag !== null) {
20 $tag >= 0 || throw MetadataStatementLoadingException::create(
21 'Invalid data. The parameter "tag" shall be a positive integer'
22 );
23 }
24 }
25
26 public static function create(
27 string $id,
28 ?int $tag = null,
29 ?string $data = null,
30 bool $failIfUnknown = false
31 ): self {
32 return new self($id, $tag, $data, $failIfUnknown);
33 }
34 }