FormatDescriptionEventDTO::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
c 2
b 1
f 0
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
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 58
    public function getType(): string
13
    {
14 58
        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
    #[\ReturnTypeWillChange]
27
    public function jsonSerialize()
28
    {
29
        return get_object_vars($this);
30
    }
31
}
32