Passed
Pull Request — master (#6)
by Moln
03:44
created

FormatDescriptionEventDTO   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 22.22%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 21
ccs 2
cts 9
cp 0.2222
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 3 1
A getType() 0 3 1
A __toString() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
namespace MySQLReplication\Event\DTO;
5
6
use MySQLReplication\Definitions\ConstEventsNames;
7
8
class FormatDescriptionEventDTO extends EventDTO
9
{
10
    private $type = ConstEventsNames::FORMAT_DESCRIPTION;
11
12 62
    public function getType(): string
13
    {
14 62
        return $this->type;
15
    }
16
17
    public function __toString(): string
18
    {
19
        return PHP_EOL .
20
            '=== Event ' . $this->getType() . ' === ' . PHP_EOL .
21
            'Date: ' . $this->eventInfo->getDateTime() . PHP_EOL .
22
            'Log position: ' . $this->eventInfo->getPos() . PHP_EOL .
23
            'Event size: ' . $this->eventInfo->getSize() . PHP_EOL;
24
    }
25
26
    public function jsonSerialize()
27
    {
28
        return get_object_vars($this);
29
    }
30
}