AuthorizationList::setAllApplications()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace MadWizard\WebAuthn\Attestation\Android;
4
5
use function in_array;
6
7
final class AuthorizationList
8
{
9
    public const KM_ORIGIN_GENERATED = 0;
10
11
    public const KM_PURPOSE_SIGN = 2;
12
13
    /**
14
     * @var int[]
15
     */
16
    private $purposeList = [];
17
18
    /**
19
     * @var bool
20
     */
21
    private $allApplications = false;
22
23
    /**
24
     * @var int|null
25
     */
26
    private $origin;
27
28 2
    public function hasPurpose(int $purpose): bool
29
    {
30 2
        return in_array($purpose, $this->purposeList, true);
31
    }
32
33
    /**
34
     * @return int[]
35
     */
36 1
    public function getPurposeList(): array
37
    {
38 1
        return $this->purposeList;
39
    }
40
41 2
    public function addPurpose(int $purpose): void
42
    {
43 2
        $this->purposeList[] = $purpose;
44 2
    }
45
46 2
    public function hasAllApplications(): bool
47
    {
48 2
        return $this->allApplications;
49
    }
50
51
    public function setAllApplications(bool $allApplications): void
52
    {
53
        $this->allApplications = $allApplications;
54
    }
55
56 2
    public function getOrigin(): ?int
57
    {
58 2
        return $this->origin;
59
    }
60
61 2
    public function setOrigin(?int $origin): void
62
    {
63 2
        $this->origin = $origin;
64 2
    }
65
}
66