Completed
Push — master ( d7d555...8d86ce )
by Thomas
06:51 queued 03:43
created

AllowEmptyMetadataVoter::voteOnTrust()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 3
dl 0
loc 9
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 10
1
<?php
2
3
namespace MadWizard\WebAuthn\Policy\Trust\Voter;
4
5
use MadWizard\WebAuthn\Attestation\TrustAnchor\MetadataInterface;
6
use MadWizard\WebAuthn\Attestation\TrustPath\TrustPathInterface;
7
use MadWizard\WebAuthn\Policy\Trust\TrustVote;
8
use MadWizard\WebAuthn\Server\Registration\RegistrationResultInterface;
9
10
final class AllowEmptyMetadataVoter implements TrustVoterInterface
11
{
12 1
    public function voteOnTrust(
13
        RegistrationResultInterface $registrationResult,
14
        TrustPathInterface $trustPath,
15
        ?MetadataInterface $metadata
16
    ): TrustVote {
17 1
        if ($metadata === null) {
18 1
            return TrustVote::trusted();
19
        }
20
        return TrustVote::abstain();
21
    }
22
}
23