for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace MySQLReplication\Event;
/**
* Class EventInfo
* @package MySQLReplication\BinLog
*/
class EventInfo implements \JsonSerializable
{
* @var int
private $timestamp;
* @var string
private $type;
private $id;
private $size;
private $pos;
private $flag;
* @var bool
private $checkSum;
private $sizeNoHeader;
private $dateTime;
* EventInfo constructor.
* @param int $timestamp
* @param string $type
* @param int $id
* @param int $size
* @param int $pos
* @param string $flag
* @param bool $checkSum
public function __construct(
$timestamp,
$type,
$id,
$size,
$pos,
$flag,
$checkSum
) {
$this->timestamp = $timestamp;
$this->type = $type;
$this->id = $id;
$this->size = $size;
$this->pos = $pos;
$this->flag = $flag;
$this->checkSum = $checkSum;
}
* @return string
public function getDateTime()
if (empty($this->dateTime)) {
$this->dateTime = date('c', $this->timestamp);
return $this->dateTime;
public function getSizeNoHeader()
if (empty($this->sizeNoHeader)) {
$this->sizeNoHeader = (true === $this->checkSum ? $this->size - 23 : $this->size - 19);
return $this->sizeNoHeader;
* @return int
public function getTimestamp()
return $this->timestamp;
public function getType()
return $this->type;
public function getId()
return $this->id;
public function getSize()
return $this->size;
public function getPos()
return $this->pos;
public function getFlag()
return $this->flag;
* Specify data which should be serialized to JSON
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
* @since 5.4.0
public function jsonSerialize()
return get_object_vars($this);