TpmStructureTrait::readFixed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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