artur-graniszewski/pdo-proxy

View on GitHub
src/ProxyConfiguration.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace PDOProxy;

class ProxyConfiguration
{
    /**
     * @var EventManager
     */
    private static $eventManager;
    
    public static function init(EventManager $eventManager)
    {
        self::$eventManager = $eventManager;
    }
    
    public static function reset()
    {
        self::$eventManager = null;
    }
    
    public static function getEventManager() : EventManager
    {
        if (!isset(self::$eventManager)) {
            throw new \LogicException("Event Manager not initialized");
        }
        return self::$eventManager;
    }
}