Submit
Path:
~
/
/
opt
/
psa
/
phpMyAdmin
/
vendor
/
web-auth
/
metadata-service
/
src
/
File Content:
ExtensionDescriptor.php
<?php declare(strict_types=1); /* * The MIT License (MIT) * * Copyright (c) 2014-2021 Spomky-Labs * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ namespace Webauthn\MetadataService; use function array_key_exists; use Assert\Assertion; use JsonSerializable; class ExtensionDescriptor implements JsonSerializable { /** * @var string */ private $id; /** * @var int|null */ private $tag; /** * @var string|null */ private $data; /** * @var bool */ private $fail_if_unknown; public function __construct(string $id, ?int $tag, ?string $data, bool $fail_if_unknown) { if (null !== $tag) { Assertion::greaterOrEqualThan($tag, 0, Utils::logicException('Invalid data. The parameter "tag" shall be a positive integer')); } $this->id = $id; $this->tag = $tag; $this->data = $data; $this->fail_if_unknown = $fail_if_unknown; } public function getId(): string { return $this->id; } public function getTag(): ?int { return $this->tag; } public function getData(): ?string { return $this->data; } public function isFailIfUnknown(): bool { return $this->fail_if_unknown; } public static function createFromArray(array $data): self { $data = Utils::filterNullValues($data); Assertion::keyExists($data, 'id', Utils::logicException('Invalid data. The parameter "id" is missing')); Assertion::string($data['id'], Utils::logicException('Invalid data. The parameter "id" shall be a string')); Assertion::keyExists($data, 'fail_if_unknown', Utils::logicException('Invalid data. The parameter "fail_if_unknown" is missing')); Assertion::boolean($data['fail_if_unknown'], Utils::logicException('Invalid data. The parameter "fail_if_unknown" shall be a boolean')); if (array_key_exists('tag', $data)) { Assertion::integer($data['tag'], Utils::logicException('Invalid data. The parameter "tag" shall be a positive integer')); } if (array_key_exists('data', $data)) { Assertion::string($data['data'], Utils::logicException('Invalid data. The parameter "data" shall be a string')); } return new self( $data['id'], $data['tag'] ?? null, $data['data'] ?? null, $data['fail_if_unknown'] ); } public function jsonSerialize(): array { $result = [ 'id' => $this->id, 'tag' => $this->tag, 'data' => $this->data, 'fail_if_unknown' => $this->fail_if_unknown, ]; return Utils::filterNullValues($result); } }
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
AbstractDescriptor.php
1183 bytes
0644
AuthenticatorStatus.php
2133 bytes
0644
BiometricAccuracyDescriptor.php
2486 bytes
0644
BiometricStatusReport.php
2890 bytes
0644
CodeAccuracyDescriptor.php
1951 bytes
0644
DisplayPNGCharacteristicsDescriptor.php
4178 bytes
0644
DistantSingleMetadata.php
2247 bytes
0644
EcdaaTrustAnchor.php
2473 bytes
0644
ExtensionDescriptor.php
2850 bytes
0644
MetadataService.php
10209 bytes
0644
MetadataStatement.php
17561 bytes
0644
MetadataStatementFetcher.php
3884 bytes
0644
MetadataStatementRepository.php
679 bytes
0644
MetadataTOCPayload.php
3657 bytes
0644
MetadataTOCPayloadEntry.php
5624 bytes
0644
PatternAccuracyDescriptor.php
1928 bytes
0644
RgbPaletteEntry.php
1736 bytes
0644
RogueListEntry.php
1351 bytes
0644
SingleMetadata.php
1147 bytes
0644
StatusReport.php
4676 bytes
0644
Utils.php
810 bytes
0644
VerificationMethodANDCombinations.php
1475 bytes
0644
VerificationMethodDescriptor.php
5021 bytes
0644
Version.php
1847 bytes
0644
N4ST4R_ID | Naxtarrr