Total Complexity | 6 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | abstract class AbstractExtensionInput implements ExtensionInputInterface |
||
10 | { |
||
11 | use SerializableTrait; |
||
12 | |||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | private $identifier; |
||
17 | |||
18 | /** |
||
19 | * @var mixed // TODO stricter type? |
||
20 | */ |
||
21 | protected $input; |
||
22 | |||
23 | 7 | public function __construct(string $identifier) |
|
24 | { |
||
25 | 7 | $this->identifier = $identifier; |
|
26 | |||
27 | 7 | if (!ExtensionHelper::validExtensionIdentifier($identifier)) { |
|
28 | 1 | throw new WebAuthnException(sprintf("Invalid extension identifier '%s'.", $identifier)); |
|
29 | } |
||
30 | 6 | } |
|
31 | |||
32 | 3 | public function getIdentifier(): string |
|
33 | { |
||
34 | 3 | return $this->identifier; |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return mixed |
||
39 | */ |
||
40 | 4 | public function getInput() |
|
41 | { |
||
42 | 4 | return $this->input; |
|
43 | } |
||
44 | |||
45 | 1 | public function __serialize(): array |
|
48 | } |
||
49 | |||
50 | 1 | public function __unserialize(array $data): void |
|
54 | 1 | } |
|
55 | } |
||
56 |