Passed
Pull Request — master (#19)
by
unknown
06:08 queued 02:43
created

MariaDbGtidListEvent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A makeMariaDbGTIDListDTO() 0 17 2
1
<?php
2
declare(strict_types=1);
3
4
namespace MySQLReplication\Event;
5
6
use MySQLReplication\Event\DTO\MariaDbGtidListDTO;
7
8
class MariaDbGtidListEvent extends EventCommon
9
{
10
    public function makeMariaDbGTIDListDTO(): MariaDbGtidListDTO
11
    {
12
        $gtid_count = $this->binaryDataReader->readUInt32();
13
        $gtid_list = [];
14
        for($i=0;$i < $gtid_count;$i++) {
15
            $domainId = $this->binaryDataReader->readUInt32();
16
            $serverId = $this->binaryDataReader->readUInt32();
17
            $seq = $this->binaryDataReader->readUInt64();
18
            array_push($gtid_list,$domainId . '-' . $serverId . '-' . $seq);
19
        }
20
        $mariaDbGtidList = implode(',', $gtid_list);
21
22
        //$this->eventInfo->getBinLogCurrent()->setMariaDbGtid($mariaDbGtid);
23
24
        return new MariaDbGtidListDTO(
25
            $this->eventInfo,
26
            $mariaDbGtidList
27
        );
28
    }
29
}
30