Stats::getTime()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
namespace kalanis\RemoteRequest\Protocols\Fsp\Answer;
4
5
6
use kalanis\RemoteRequest\Protocols\Fsp;
7
8
9
/**
10
 * Class Stats
11
 * @package kalanis\RemoteRequest\Protocols\Fsp\Answer
12
 * Process stats answer
13
 */
14
class Stats extends AAnswer
15
{
16
    protected int $time = 0;
17
    protected int $size = 0;
18
    protected int $type = 0;
19
20 1
    public function process(): parent
21
    {
22 1
        $data = $this->answer->getContent();
23 1
        $this->time = Fsp\Strings::mb_ord(substr($data, 0, 4));
24 1
        $this->size = Fsp\Strings::mb_ord(substr($data, 4, 4));
25 1
        $this->type = Fsp\Strings::mb_ord($data[8]);
26 1
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type kalanis\RemoteRequest\Protocols\Fsp\Answer\Stats which is incompatible with the type-hinted return parent.
Loading history...
27
    }
28
29 1
    public function getTime(): int
30
    {
31 1
        return $this->time;
32
    }
33
34 1
    public function getSize(): int
35
    {
36 1
        return $this->size;
37
    }
38
39 1
    public function getType(): int
40
    {
41 1
        return $this->type;
42
    }
43
}
44