THeader::renderRequestHeader()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
ccs 8
cts 8
cp 1
crap 1
1
<?php
2
3
namespace kalanis\RemoteRequest\Protocols\Fsp\Traits;
4
5
6
use kalanis\RemoteRequest\Protocols\Fsp;
7
8
9
/**
10
 * Trait THeader
11
 * @package kalanis\RemoteRequest\Protocols\Fsp\Traits
12
 * Process header
13
 */
14
trait THeader
15
{
16 17
    protected function renderRequestHeader(): string
17
    {
18 17
        return sprintf('%s%s%s%s%s%s',
19 17
            Fsp\Strings::filler($this->getCommand(), 1),
20 17
            Fsp\Strings::filler(0, 1),
21 17
            Fsp\Strings::filler($this->getKey(), 2),
22 17
            Fsp\Strings::filler($this->getSequence(), 2),
23 17
            Fsp\Strings::filler($this->getDataLength(), 2),
24 17
            Fsp\Strings::filler($this->getFilePosition(), 4)
25 17
        );
26
    }
27
28
    abstract protected function getCommand(): int;
29
30
    abstract protected function getKey(): int;
31
32
    abstract protected function getSequence(): int;
33
34
    abstract protected function getDataLength(): int;
35
36
    abstract protected function getFilePosition(): int;
37
38
    abstract protected function getContent(): string;
39
}
40