1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * The MIT License (MIT) |
||
7 | * |
||
8 | * Copyright (c) 2018 Spomky-Labs |
||
9 | * |
||
10 | * This software may be modified and distributed under the terms |
||
11 | * of the MIT license. See the LICENSE file for details. |
||
12 | */ |
||
13 | |||
14 | namespace U2FAuthentication\Fido2; |
||
15 | |||
16 | class PublicKeyCredentialRpEntity extends PublicKeyCredentialEntity |
||
17 | { |
||
18 | /** |
||
19 | * @var null|string |
||
20 | */ |
||
21 | private $id; |
||
22 | |||
23 | /** |
||
24 | * PublicKeyCredentialRpEntity constructor. |
||
25 | * @param string $name |
||
26 | * @param null|string $icon |
||
27 | * @param null|string $id |
||
28 | */ |
||
29 | public function __construct(string $name, ?string $icon, ?string $id) |
||
30 | { |
||
31 | parent::__construct($name, $icon); |
||
32 | $this->id = $id; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return string |
||
37 | */ |
||
38 | public function getId(): string |
||
39 | { |
||
40 | return $this->id; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
41 | } |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | public function jsonSerialize(): array |
||
47 | { |
||
48 | $json = parent::jsonSerialize(); |
||
49 | if ($this->id) { |
||
50 | $json['id'] = $this->id; |
||
51 | } |
||
52 | |||
53 | return $json; |
||
54 | } |
||
55 | } |
||
56 |