AuthenticatorTransport::isValidValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace MadWizard\WebAuthn\Dom;
4
5
final class AuthenticatorTransport
6
{
7
    /**
8
     * USB.
9
     */
10
    public const USB = 'usb';
11
12
    /**
13
     * Near Field Communication (NFC).
14
     */
15
    public const NFC = 'nfc';
16
17
    /**
18
     * Bluetooth Smart (Bluetooth Low Energy / BLE).
19
     */
20
    public const BLE = 'ble';
21
22
    /**
23
     * Client device-specific transport. These authenticators are not removable from the client device.
24
     */
25
    public const INTERNAL = 'internal';
26
27
    /**
28
     * @codeCoverageIgnore
29
     */
30
    private function __construct()
31
    {
32
    }
33
34 2
    public static function isValidValue(string $value): bool
35
    {
36 2
        return in_array($value, self::allKnownTransports(), true);
37
    }
38
39 3
    public static function allKnownTransports(): array
40
    {
41 3
        return [self::USB, self::NFC, self::BLE, self::INTERNAL];
42
    }
43
}
44