PHP Classes

File: src/MySQLReplication/Event/DTO/RotateDTO.php

Recommend this page to a friend!
  Classes of Kacper Rowinski   PHP MySQL Replication   src/MySQLReplication/Event/DTO/RotateDTO.php   Download  
File: src/MySQLReplication/Event/DTO/RotateDTO.php
Role: Configuration script
Content type: text/plain
Description: Configuration script
Class: PHP MySQL Replication
Client to get MySQL replication events in pure PHP
Author: By
Last change: New release (#104)

* - Change: drop support for < 8.2
- Change: moved to enums, promoted properties
- Added: logger for more socket info
- Added: slave_uuid support
- Change: config no longer static
- Chore: typos in README/code
- Chore: replace/remove old urls from code
- Chore: changed variables to underscore
- Added: support caching_sha2_password
- Change: BinLogServerInfo static calls removed also added method getServerInfo to MySQLReplicationFactory
Date: 15 days ago
Size: 1,113 bytes
 

 

Contents

Class file image Download
<?php

declare(strict_types=1);

namespace
MySQLReplication\Event\DTO;

use
MySQLReplication\Definitions\ConstEventsNames;
use
MySQLReplication\Event\EventInfo;

class
RotateDTO extends EventDTO
{
    private
ConstEventsNames $type = ConstEventsNames::ROTATE;

    public function
__construct(
       
EventInfo $eventInfo,
        public
readonly string $position,
        public
readonly string $nextBinlog
   
) {
       
parent::__construct($eventInfo);
    }

    public function
__toString(): string
   
{
        return
PHP_EOL .
           
'=== Event ' . $this->getType() . ' === ' . PHP_EOL .
           
'Date: ' . $this->eventInfo->getDateTime() . PHP_EOL .
           
'Log position: ' . $this->eventInfo->pos . PHP_EOL .
           
'Event size: ' . $this->eventInfo->size . PHP_EOL .
           
'Binlog position: ' . $this->position . PHP_EOL .
           
'Binlog filename: ' . $this->nextBinlog . PHP_EOL;
    }

    public function
getType(): string
   
{
        return
$this->type->value;
    }

    public function
jsonSerialize(): array
    {
        return
get_object_vars($this);
    }
}