RowEventBuilder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 8 1
A __construct() 0 8 1
A withPackage() 0 3 1
A withEventInfo() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace MySQLReplication\Event\RowEvent;
5
6
use MySQLReplication\BinaryDataReader\BinaryDataReader;
7
use MySQLReplication\Config\Config;
8
use MySQLReplication\Event\EventInfo;
9
use MySQLReplication\Repository\RepositoryInterface;
10
use Psr\SimpleCache\CacheInterface;
11
12
class RowEventBuilder
13
{
14
    private $repository;
15
    private $cache;
16
    /**
17
     * @var BinaryDataReader
18
     */
19
    private $package;
20
    /**
21
     * @var EventInfo
22
     */
23
    private $eventInfo;
24
    /**
25
     * @var Config
26
     */
27
    private $config;
28
29 58
    public function __construct(
30
        Config $config,
31
        RepositoryInterface $repository,
32
        CacheInterface $cache
33
    ) {
34 58
        $this->repository = $repository;
35 58
        $this->cache = $cache;
36 58
        $this->config = $config;
37
    }
38
39 54
    public function withPackage(BinaryDataReader $package): void
40
    {
41 54
        $this->package = $package;
42
    }
43
44 54
    public function build(): RowEvent
45
    {
46 54
        return new RowEvent(
47 54
            $this->config,
48 54
            $this->repository,
49 54
            $this->package,
50 54
            $this->eventInfo,
51 54
            $this->cache
52 54
        );
53
    }
54
55 54
    public function withEventInfo(EventInfo $eventInfo): void
56
    {
57 54
        $this->eventInfo = $eventInfo;
58
    }
59
}
60