Total Complexity | 8 |
Total Lines | 89 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | class PublicKeyCredentialDescriptor implements \JsonSerializable |
||
17 | { |
||
18 | public const PUBLIC_KEY_CREDENTIAL_TYPE_PUBLIC_KEY = 'public-key'; |
||
19 | |||
20 | public const AUTHENTICATOR_TRANSPORT_USB = 'usb'; |
||
21 | public const AUTHENTICATOR_TRANSPORT_NFC = 'nfc'; |
||
22 | public const AUTHENTICATOR_TRANSPORT_BLE = 'ble'; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $type; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $id; |
||
33 | |||
34 | /** |
||
35 | * @var string[] |
||
36 | */ |
||
37 | private $transports; |
||
38 | |||
39 | /** |
||
40 | * PublicKeyCredentialDescriptor constructor. |
||
41 | * |
||
42 | * @param string $type |
||
43 | * @param string $id |
||
44 | * @param string[] $transports |
||
45 | */ |
||
46 | public function __construct(string $type, string $id, array $transports = []) |
||
47 | { |
||
48 | $this->type = $type; |
||
49 | $this->id = $id; |
||
50 | $this->transports = $transports; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return string |
||
55 | */ |
||
56 | public function getType(): string |
||
57 | { |
||
58 | return $this->type; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getId(): string |
||
65 | { |
||
66 | return $this->id; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return string[] |
||
71 | */ |
||
72 | public function getTransports(): array |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | public function jsonSerialize() |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * @return int[] |
||
95 | */ |
||
96 | private function splitId(): array |
||
107 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.