Passed
Push — master ( fb2510...e090ea )
by kacper
03:41
created

RowEventFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 11
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 3
crap 1
1
<?php
2
3
namespace MySQLReplication\Event\RowEvent;
4
5
use MySQLReplication\BinaryDataReader\BinaryDataReader;
6
use MySQLReplication\Event\EventInfo;
7
use MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderFactory;
8
use MySQLReplication\Repository\RepositoryInterface;
9
use Psr\SimpleCache\CacheInterface;
10
11
/**
12
 * Class RowEventService
13
 * @package MySQLReplication\RowEvent
14
 */
15 View Code Duplication
class RowEventFactory
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
    /**
18
     * @var RowEventBuilder
19
     */
20
    private $rowEventBuilder;
21
22
    /**
23
     * RowEventService constructor.
24
     * @param RepositoryInterface $repository
25
     * @param JsonBinaryDecoderFactory $jsonBinaryDecoderFactory
26
     * @param CacheInterface $cache
27
     */
28 54
    public function __construct(
29
        RepositoryInterface $repository,
30
        JsonBinaryDecoderFactory $jsonBinaryDecoderFactory,
31
        CacheInterface $cache
32
    ) {
33 54
        $this->rowEventBuilder = new RowEventBuilder(
34 54
            $repository,
35 54
            $jsonBinaryDecoderFactory,
36
            $cache
37 54
        );
38 54
    }
39
40
    /**
41
     * @param BinaryDataReader $package
42
     * @param EventInfo $eventInfo
43
     * @return RowEvent
44
     */
45 52
    public function makeRowEvent(BinaryDataReader $package, EventInfo $eventInfo)
46
    {
47 52
        $this->rowEventBuilder->withPackage($package);
48 52
        $this->rowEventBuilder->withEventInfo($eventInfo);
49
50 52
        return $this->rowEventBuilder->build();
51
    }
52
}