AuthenticatorTransport   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 37
ccs 4
cts 4
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A isValidValue() 0 3 1
A allKnownTransports() 0 3 1
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