Passed
Pull Request — master (#53)
by kacper
04:21
created

MasterStatusDTO   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
c 1
b 0
f 1
dl 0
loc 29
ccs 12
cts 12
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFile() 0 3 1
A makeFromArray() 0 5 1
A getPosition() 0 3 1
A __construct() 0 6 1
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
}