Completed
Pull Request — master (#53)
by kacper
04:43 queued 23s
created

MasterStatusDTO::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace MySQLReplication\Repository;
5
6
class MasterStatusDTO
7
{
8
    private $position;
9
    private $file;
10
11 57
    public function __construct(
12
        int $position,
13
        string $file
14
    ) {
15 57
        $this->position = $position;
16 57
        $this->file = $file;
17 57
    }
18
19 57
    public static function makeFromArray(array $data): self
20
    {
21 57
        return new self(
22 57
            (int)$data['Position'],
23 57
            (string)$data['File']
24
        );
25
    }
26
27 56
    public function getPosition(): int
28
    {
29 56
        return $this->position;
30
    }
31
32 56
    public function getFile(): string
33
    {
34 56
        return $this->file;
35
    }
36
}