TpmEccPublicId   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 36
ccs 13
cts 13
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 6 1
A __construct() 0 4 1
A getX() 0 3 1
A getY() 0 3 1
1
<?php
2
3
namespace MadWizard\WebAuthn\Attestation\Tpm;
4
5
use MadWizard\WebAuthn\Format\ByteBuffer;
6
7
class TpmEccPublicId implements KeyPublicIdInterface
8
{
9
    use TpmStructureTrait;
10
11
    /**
12
     * @var ByteBuffer
13
     */
14
    private $x;
15
16
    /**
17
     * @var ByteBuffer
18
     */
19
    private $y;
20
21 1
    private function __construct(ByteBuffer $x, ByteBuffer $y)
22
    {
23 1
        $this->x = $x;
24 1
        $this->y = $y;
25 1
    }
26
27 1
    public function getX(): ByteBuffer
28
    {
29 1
        return $this->x;
30
    }
31
32 1
    public function getY(): ByteBuffer
33
    {
34 1
        return $this->y;
35
    }
36
37 1
    public static function parse(ByteBuffer $buffer, int $offset, ?int &$endOffset): KeyPublicIdInterface
38
    {
39 1
        $x = self::readLengthPrefixed($buffer, $offset);
40 1
        $y = self::readLengthPrefixed($buffer, $offset);
41 1
        $endOffset = $offset;
42 1
        return new self($x, $y);
43
    }
44
}
45