RowEventBuilder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 14
c 2
b 0
f 0
dl 0
loc 39
ccs 15
cts 15
cp 1
rs 10
wmc 4

4 Methods

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