public static function getEventManager($app)
    {
        if (self::$_eventManager) {
            return self::$_eventManager;
        }
        foreach ($app->components as $name => $config) {
            $class = is_string($config) ? $config : @$config['class'];
            if($class == str_replace('Bootstrap', 'Manager', get_called_class())){
                return self::$_eventManager = $app->$name;
            }
        }
        $eventFile = \Yii::getAlias('@app/config/_events.php');
        $app->setComponents([
            'eventManager' => [
                'class'  => 'bariew\eventManager\EventManager',
                'events' => file_exists($eventFile) && is_file($eventFile)
                    ? include $eventFile 
                    : []
            ],
        ]);
        return self::$_eventManager = $app->eventManager;
    }