Test Failed
Push — master ( 51d50e...3266fb )
by Thomas
06:40 queued 03:58
created

TpmRsaPublicId::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace MadWizard\WebAuthn\Attestation\Tpm;
4
5
use MadWizard\WebAuthn\Format\ByteBuffer;
6
7
class TpmRsaPublicId implements KeyPublicIdInterface
8
{
9
    use TpmStructureTrait;
10
11
    /**
12
     * @var ByteBuffer
13
     */
14
    private $modulus;
15
16
    private function __construct(ByteBuffer $modulus)
17
    {
18
        $this->modulus = $modulus;
19
    }
20
21
    public function getModulus(): ByteBuffer
22
    {
23
        return $this->modulus;
24
    }
25
26
    public static function parse(ByteBuffer $buffer, int $offset, ?int &$endOffset): KeyPublicIdInterface
27
    {
28
        $modulus = self::readLengthPrefixed($buffer, $offset);
29
        $endOffset = $offset;
30
        return new self($modulus);
31
    }
32
}
33