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

TpmStructureTrait::readFixed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 5
rs 10
1
<?php
2
3
namespace MadWizard\WebAuthn\Attestation\Tpm;
4
5
use MadWizard\WebAuthn\Format\ByteBuffer;
6
7
trait TpmStructureTrait
8
{
9
    private static function readLengthPrefixed(ByteBuffer $buffer, int &$offset): ByteBuffer
10
    {
11
        $len = $buffer->getUint16Val($offset);
12
        $data = $buffer->getBytes($offset + 2, $len);
13
        $offset += (2 + $len);
14
        return new ByteBuffer($data);
15
    }
16
17
    private static function readFixed(ByteBuffer $buffer, int &$offset, int $length): ByteBuffer
18
    {
19
        $data = $buffer->getBytes($offset, $length);
20
        $offset += $length;
21
        return new ByteBuffer($data);
22
    }
23
}
24