public static function instance($manager = null)
    {
        if ($manager instanceof EventManager) {
            static::$_generalManager = $manager;
        }
        if (empty(static::$_generalManager)) {
            static::$_generalManager = new static();
        }

        static::$_generalManager->_isGlobal = true;

        return static::$_generalManager;
    }
public static function instance($manager = null)
    {
        if ($manager instanceof EventManager) {
            static::$_generalManager = $manager;
        }
        if (empty(static::$_generalManager)) {
            static::$_generalManager = new static();
        }

        static::$_generalManager->_isGlobal = true;

        return static::$_generalManager;
    }
public static function instance ( $ manager = null ) { if ( $ manager instanceof EventManager ) { static :: $ _generalManager = $ manager ; } if ( empty ( static :: $ _generalManager ) ) { static :: $ _generalManager = new static ( ) ; } static :: $ _generalManager -> _isGlobal = true ; return static :: $ _generalManager ; }
Returns the globally available instance of a Cake\Event\EventManager
this is used for dispatching events attached from outside the scope
other managers were created. Usually for creating hook systems or inter-class
communication

If called with the first parameter, it will be set as the globally available instance

@param \Cake\Event\EventManager|null $manager Event manager instance.
@return static The global event manager
Returns the globally available instance of a Cake \ Event \ EventManager this is used for dispatching events attached from outside the scope other managers were created . Usually for creating hook systems or inter - class communication