PHP Classes

File: src/MySQLReplication/BinLog/BinLogAuthPluginMode.php

Recommend this page to a friend!
  Classes of Kacper Rowinski   PHP MySQL Replication   src/MySQLReplication/BinLog/BinLogAuthPluginMode.php   Download  
File: src/MySQLReplication/BinLog/BinLogAuthPluginMode.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP MySQL Replication
Client to get MySQL replication events in pure PHP
Author: By
Last change:
Date: 13 days ago
Size: 690 bytes
 

Contents

Class file image Download
<?php

declare(strict_types=1);

namespace
MySQLReplication\BinLog;

use
MySQLReplication\Exception\MySQLReplicationException;

enum BinLogAuthPluginMode: string
{
    case
MysqlNativePassword = 'mysql_native_password';
    case
CachingSha2Password = 'caching_sha2_password';

    public static function
make(string $authPluginName): self
   
{
       
$authPlugin = self::tryFrom($authPluginName);
        if (
$authPlugin === null) {
            throw new
MySQLReplicationException(
               
MySQLReplicationException::BINLOG_AUTH_NOT_SUPPORTED,
               
MySQLReplicationException::BINLOG_AUTH_NOT_SUPPORTED_CODE
           
);
        }

        return
$authPlugin;
    }
}