HeartbeatDTO::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace MySQLReplication\Event\DTO;
5
6
use MySQLReplication\Definitions\ConstEventsNames;
7
8
class HeartbeatDTO extends EventDTO
9
{
10
    protected $type = ConstEventsNames::HEARTBEAT;
11
12
    public function __toString(): string
13
    {
14
        return PHP_EOL .
15
            '=== Event ' . $this->getType() . ' === ' . PHP_EOL .
16
            'Date: ' . $this->eventInfo->getDateTime() . PHP_EOL .
17
            'Log position: ' . $this->eventInfo->getPos() . PHP_EOL .
18
            'Event size: ' . $this->eventInfo->getSize() . PHP_EOL;
19
    }
20
21
    public function getType(): string
22
    {
23
        return $this->type;
24
    }
25
26
    public function jsonSerialize()
27
    {
28
        return get_object_vars($this);
29
    }
30
}