Passed
Push — master ( 3a2451...e6e9f9 )
by Thomas
08:19 queued 05:35
created

AbstractTpmStructure::readFixed()   A

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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
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
abstract class AbstractTpmStructure
8
{
9 7
    protected function readLengthPrefixed(ByteBuffer $buffer, int &$offset): ByteBuffer
10
    {
11 7
        $len = $buffer->getUint16Val($offset);
12 7
        $data = $buffer->getBytes($offset + 2, $len);
13 7
        $offset += (2 + $len);
14 7
        return new ByteBuffer($data);
15
    }
16
17 4
    protected 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