protected function bootstrapExtensions($app)
    {
        $rhoone = Yii::$app->rhoone;
        /* @var $rhoone \rhoone\base\Rhoone */
        $extensions = $rhoone->extensions;
        if (empty($extensions)) {
            return 0;
        }
        foreach ($extensions as $id => $extension) {
            if ($extension instanceof BootstrapInterface) {
                try {
                    $extension->bootstrap($app);
                } catch (\Exception $ex) {
                    Yii::error($ex->getMessage(), __METHOD__);
                    continue;
                }
            }
        }

        $count = 0;
        foreach ($extensions as $ext) {
            $moduleConfig = [];
            try {
                $moduleConfig = $ext->getModule();
            } catch (\Exception $ex) {
                continue;
            }
            if (empty($moduleConfig)) {
                continue;
            }
            Yii::info("`" . $moduleConfig['id'] . '` enabled.', __METHOD__);
            $app->setModule($moduleConfig['id'], $moduleConfig);
            $module = $app->getModule($moduleConfig['id']);
            if ($module instanceof BootstrapInterface) {
                $app->bootstrap[] = $module->id;
                Yii::trace('Bootstrap with ' . $module->className() . '::' . 'bootstrap()', __METHOD__);
                $module->bootstrap($app);
                $count++;
            }
        }
        return $count;
    }