Passed
Push — master ( a019b6...0010e9 )
by Thomas
08:57
created

AbstractExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 57.14%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
dl 0
loc 19
ccs 4
cts 7
cp 0.5714
rs 10
c 1
b 0
f 1
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A getIdentifier() 0 3 1
1
<?php
2
3
namespace MadWizard\WebAuthn\Extension;
4
5
use MadWizard\WebAuthn\Exception\WebAuthnException;
6
7
abstract class AbstractExtension implements ExtensionInterface
8
{
9
    /**
10
     * @var string
11
     */
12
    private $identifier;
13
14 5
    public function __construct(string $identifier)
15
    {
16 5
        $this->identifier = $identifier;
17
18 5
        if (!ExtensionHelper::validExtensionIdentifier($identifier)) {
19
            throw new WebAuthnException(sprintf("Invalid extension identifier '%s'.", $identifier));
20
        }
21 5
    }
22
23
    public function getIdentifier(): string
24
    {
25
        return $this->identifier;
26
    }
27
}
28