| Total Complexity | 5 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Coverage | 35.29% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class XidDTO extends EventDTO |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private $type = ConstEventsNames::XID; |
||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $xid; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * GTIDLogEventDTO constructor. |
||
| 25 | * @param EventInfo $eventInfo |
||
| 26 | * @param string $xid |
||
| 27 | */ |
||
| 28 | 3 | public function __construct( |
|
| 29 | EventInfo $eventInfo, |
||
| 30 | $xid |
||
| 31 | ) { |
||
| 32 | 3 | parent::__construct($eventInfo); |
|
| 33 | |||
| 34 | 3 | $this->xid = $xid; |
|
| 35 | 3 | } |
|
| 36 | |||
| 37 | /** |
||
| 38 | * @return string |
||
| 39 | */ |
||
| 40 | public function getXid() |
||
| 41 | { |
||
| 42 | return $this->xid; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return string |
||
| 47 | */ |
||
| 48 | 3 | public function getType() |
|
| 49 | { |
||
| 50 | 3 | return $this->type; |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return string |
||
| 55 | */ |
||
| 56 | public function __toString() |
||
| 57 | { |
||
| 58 | return PHP_EOL . |
||
| 59 | '=== Event ' . $this->getType() . ' === ' . PHP_EOL . |
||
| 60 | 'Date: ' . $this->eventInfo->getDateTime() . PHP_EOL . |
||
| 61 | 'Log position: ' . $this->eventInfo->getPos() . PHP_EOL . |
||
| 62 | 'Event size: ' . $this->eventInfo->getSize() . PHP_EOL . |
||
| 63 | 'Transaction ID: ' . $this->xid . PHP_EOL; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Specify data which should be serialized to JSON |
||
| 68 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
| 69 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
| 70 | * which is a value of any type other than a resource. |
||
| 71 | * @since 5.4.0 |
||
| 72 | */ |
||
| 73 | public function jsonSerialize() |
||
| 76 | } |
||
| 77 | } |