forked from krowinski/php-mysql-replication
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXidDTO.php
More file actions
45 lines (36 loc) · 1.04 KB
/
XidDTO.php
File metadata and controls
45 lines (36 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
declare(strict_types=1);
namespace MySQLReplication\Event\DTO;
use MySQLReplication\Definitions\ConstEventsNames;
use MySQLReplication\Event\EventInfo;
use MySQLReplication\Util\JsonSerializableTrait;
class XidDTO extends EventDTO
{
use JsonSerializableTrait;
private $type = ConstEventsNames::XID;
private $xid;
public function __construct(
EventInfo $eventInfo,
string $xid
) {
parent::__construct($eventInfo);
$this->xid = $xid;
}
public function getXid(): string
{
return $this->xid;
}
public function __toString(): string
{
return PHP_EOL .
'=== Event ' . $this->getType() . ' === ' . PHP_EOL .
'Date: ' . $this->eventInfo->getDateTime() . PHP_EOL .
'Log position: ' . $this->eventInfo->getPos() . PHP_EOL .
'Event size: ' . $this->eventInfo->getSize() . PHP_EOL .
'Transaction ID: ' . $this->xid . PHP_EOL;
}
public function getType(): string
{
return $this->type;
}
}