getRequireResidentKey()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace MadWizard\WebAuthn\Dom;
4
5
use InvalidArgumentException;
6
7
final class AuthenticatorSelectionCriteria extends AbstractDictionary
8
{
9
    /**
10
     * Platform attachment value from the AuthenticatorAttachment enumeration.
11
     *
12
     * @see AuthenticatorAttachment
13
     *
14
     * @var string|null
15
     */
16
    private $authenticatorAttachment;
17
18
    /**
19
     * @var bool|null
20
     */
21
    private $requireResidentKey;
22
23
    /**
24
     * @see UserVerificationRequirement
25
     *
26
     * @var string|null
27
     */
28
    private $userVerification;
29
30 2
    public function getAuthenticatorAttachment(): ?string
31
    {
32 2
        return $this->authenticatorAttachment;
33
    }
34
35 2
    public function setAuthenticatorAttachment(?string $value): void
36
    {
37 2
        if ($value !== null && !AuthenticatorAttachment::isValidValue($value)) {
38 1
            throw new InvalidArgumentException(sprintf('Value %s is not a valid AuthenticatorAttachment', $value));
39
        }
40 1
        $this->authenticatorAttachment = $value;
41 1
    }
42
43 2
    public function getRequireResidentKey(): ?bool
44
    {
45 2
        return $this->requireResidentKey;
46
    }
47
48 1
    public function setRequireResidentKey(?bool $value): void
49
    {
50 1
        $this->requireResidentKey = $value;
51 1
    }
52
53 2
    public function getUserVerification(): ?string
54
    {
55 2
        return $this->userVerification;
56
    }
57
58 3
    public function setUserVerification(?string $value): void
59
    {
60 3
        if ($value !== null && !UserVerificationRequirement::isValidValue($value)) {
61 1
            throw new InvalidArgumentException(sprintf('Value %s is not a valid UserVerificationRequirement', $value));
62
        }
63 2
        $this->userVerification = $value;
64 2
    }
65
66 1
    public function getAsArray(): array
67
    {
68 1
        $map = [];
69 1
        if ($this->authenticatorAttachment !== null) {
70
            $map['authenticatorAttachment'] = $this->authenticatorAttachment;
71
        }
72
73 1
        if ($this->requireResidentKey !== null) {
74
            $map['requireResidentKey'] = $this->requireResidentKey;
75
        }
76 1
        if ($this->userVerification !== null) {
77 1
            $map['userVerification'] = $this->userVerification;
78
        }
79 1
        return $map;
80
    }
81
}
82