AuthorizationList   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Test Coverage

Coverage 81.25%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 57
ccs 13
cts 16
cp 0.8125
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setOrigin() 0 3 1
A addPurpose() 0 3 1
A getOrigin() 0 3 1
A setAllApplications() 0 3 1
A hasPurpose() 0 3 1
A hasAllApplications() 0 3 1
A getPurposeList() 0 3 1
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