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

AllowEmptyMetadataVoter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 11
ccs 3
cts 4
cp 0.75
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A voteOnTrust() 0 9 2
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