InitResponse   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 21
c 1
b 0
f 0
dl 0
loc 40
ccs 16
cts 16
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setPassedInitData() 0 16 1
A setInitData() 0 13 1
1
<?php
2
3
namespace kalanis\UploadPerPartes\Responses;
4
5
6
use kalanis\UploadPerPartes\Uploader\Data;
7
8
/**
9
 * Class InitResponse
10
 * @package kalanis\UploadPerPartes\Responses
11
 * Responses from server to client
12
 */
13
class InitResponse extends BasicResponse
14
{
15
    public string $name = '';
16
    public int $totalParts = 0;
17
    public int $lastKnownPart = 0;
18
    public int $partSize = 0;
19
    public string $encoder = '';
20
    public string $check = '';
21
22 15
    public function setInitData(
23
        Data $data,
24
        string $encoder,
25
        string $check
26
    ): self
27
    {
28 15
        $this->name = $data->targetName;
29 15
        $this->totalParts = $data->partsCount;
30 15
        $this->lastKnownPart = $data->lastKnownPart;
31 15
        $this->partSize = $data->bytesPerPart;
32 15
        $this->encoder = $encoder;
33 15
        $this->check = $check;
34 15
        return $this;
35
    }
36
37 8
    public function setPassedInitData(
38
        string $targetName,
39
        int $partsCount,
40
        int $lastKnownPart,
41
        int $bytesPerPart,
42
        string $encoder,
43
        string $check
44
    ): self
45
    {
46 8
        $this->name = $targetName;
47 8
        $this->totalParts = $partsCount;
48 8
        $this->lastKnownPart = $lastKnownPart;
49 8
        $this->partSize = $bytesPerPart;
50 8
        $this->encoder = $encoder;
51 8
        $this->check = $check;
52 8
        return $this;
53
    }
54
}
55