Passed
Push — master ( c1fd3a...8e672b )
by Thomas
02:34
created

PublicKeyCredential::setClientExtensionResults()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace MadWizard\WebAuthn\Dom;
4
5
use MadWizard\WebAuthn\Format\ByteBuffer;
6
7
class PublicKeyCredential implements PublicKeyCredentialInterface
8
{
9
    /**
10
     * @var ByteBuffer
11
     */
12
    private $rawId;
13
14
    /**
15
     * @var AuthenticatorResponseInterface
16
     */
17
    private $response;
18
19
    /**
20
     * @var array
21
     */
22
    private $clientExtensionResults;
23
24 19
    public function __construct(ByteBuffer $rawCredentialId, AuthenticatorResponseInterface $response)
25
    {
26 19
        $this->rawId = $rawCredentialId;
27 19
        $this->response = $response;
28 19
    }
29
30
    public function getType(): string
31
    {
32
        return PublicKeyCredentialType::PUBLIC_KEY;
33
    }
34
35 15
    public function getRawId(): ByteBuffer
36
    {
37 15
        return $this->rawId;
38
    }
39
40
    /**
41
     * The credential's identifier. For public key credentials this is a base64url encoded version of the raw credential ID.
42
     */
43 1
    public function getId(): string
44
    {
45 1
        return $this->rawId->getBase64Url();
46
    }
47
48 19
    public function getResponse(): AuthenticatorResponseInterface
49
    {
50 19
        return $this->response;
51
    }
52
53
    public function setClientExtensionResults(array $extensionResults): void
54
    {
55
        $this->clientExtensionResults = $extensionResults;
56
    }
57
58
    /**
59
     * @return array Array of client extensions as provided by the client (no parsing done yet)
60
     */
61
    public function getClientExtensionResults(): array
62
    {
63
        return $this->clientExtensionResults;
64
    }
65
}
66