Passed
Push — master ( 83aa3d...907404 )
by Thomas
07:17
created

AppleDevicesProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 13
ccs 0
cts 6
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 3 1
A getMetadata() 0 6 2
1
<?php
2
3
namespace MadWizard\WebAuthn\Metadata\Provider\Apple;
4
5
use MadWizard\WebAuthn\Attestation\Statement\AppleAttestationStatement;
6
use MadWizard\WebAuthn\Attestation\TrustAnchor\MetadataInterface;
7
use MadWizard\WebAuthn\Metadata\Provider\MetadataProviderInterface;
8
use MadWizard\WebAuthn\Server\Registration\RegistrationResultInterface;
9
10
final class AppleDevicesProvider implements MetadataProviderInterface
11
{
12
    public function getMetadata(RegistrationResultInterface $registrationResult): ?MetadataInterface
13
    {
14
        if ($registrationResult->getAttestationObject()->getFormat() === AppleAttestationStatement::FORMAT_ID) {
15
            return new AppleDeviceMetadata();
16
        }
17
        return null;
18
    }
19
20
    public function getDescription(): string
21
    {
22
        return 'Apple devices metadata provider';
23
    }
24
}
25