HeartbeatDTO   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A __toString() 0 7 1
A jsonSerialize() 0 4 1
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
    #[\ReturnTypeWillChange]
27
    public function jsonSerialize()
28
    {
29
        return get_object_vars($this);
30
    }
31
}
32