GetFile::setLimit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
3
namespace kalanis\RemoteRequest\Protocols\Fsp\Query;
4
5
6
use kalanis\RemoteRequest\Protocols\Fsp;
7
8
9
/**
10
 * Class GetFile
11
 * @package kalanis\RemoteRequest\Protocols\Fsp\Query
12
 * Want file part
13
 */
14
class GetFile extends AQuery
15
{
16
    protected string $filePath = '';
17
    protected int $offset = 0;
18
    protected int $limit = 0;
19
20 1
    protected function getCommand(): int
21
    {
22 1
        return Fsp::CC_GET_FILE;
23
    }
24
25 2
    public function setFilePath(string $filePath): self
26
    {
27 2
        $this->filePath = $filePath;
28 2
        return $this;
29
    }
30
31 2
    public function setOffset(int $offset): self
32
    {
33 2
        $this->offset = $offset;
34 2
        return $this;
35
    }
36
37 1
    public function setLimit(int $limit): self
38
    {
39 1
        $this->limit = $limit;
40 1
        return $this;
41
    }
42
43 2
    protected function getFilePosition(): int
44
    {
45 2
        return $this->offset;
46
    }
47
48 2
    protected function getData(): string
49
    {
50 2
        return $this->filePath . chr(0);
51
    }
52
53 2
    protected function getExtraData(): string
54
    {
55 2
        return ($this->limit) ? Fsp\Strings::filler($this->limit, 2) : '' ;
56
    }
57
}
58