@param ModuleSetting $moduleSetting

@return $this
175893
public function addSetting(ModuleSetting $moduleSetting): ModuleConfiguration
    {
        $this->settings[$moduleSetting->getName()] = $moduleSetting;

        return $this;
    }
688278
public function addSetting(UserSetting $setting)
    {
        $this->settings->set($setting->getName(), $setting);

        return $this;
    }
567529
private function injectModuleDependencies($moduleName, DependsOnModule $module)
    {
        $this->checkForMissingDependencies($moduleName, $module);

        if (!method_exists($module, '_inject')) {
            throw new ModuleException($module, 'Module requires method _inject to be defined to accept dependencies');
        }

        $dependencies = array_map(function ($dependency) {
            return $this->create($dependency, false);
        }, $this->getConfiguredDependencies($moduleName));

        call_user_func_array([$module, '_inject'], $dependencies);
    }
1225072
protected function _initSettings()
    {
        try {

            $this->setAttributes($this->settings);
            $this->_oldAttributes = $this->toArray($this->safeAttributes());
        } catch (\Exception $e) {
            \Yii::error(\Yii::t('skeeks/cms', '{cms} component error load defaul settings',
                    ['cms' => 'Cms']).': '.$e->getMessage());
        }

        return $this;
    }
415459
public function setModuleKey(string $module_key)
    {
        if (!nb_isValidKey($module_key)) {
            throw new ENabuProviderException(ENabuProviderException::ERROR_MODULE_KEY_NOT_VALID, array($module_key));
        }
        $this->setValue(self::MODULE_KEY, $module_key);

        try {
            $this->getComplexKey();
        } catch (ENabuProviderException $ex) {

        }

        return $this;
    }
1329217
public function validate(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canValidate($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        $events = $moduleSetting->getValue();
        foreach ($this->validEvents as $validEventName) {
            if (is_array($events) && array_key_exists($validEventName, $events)) {
                $this->checkIfMethodIsCallable($events[$validEventName]);
            }
        }
    }
1065594
public function removeModuleEntity($moduleEntity)
    {
        foreach ($this->moduleEntities as $key => $moduleEntityElement) {
            if ($moduleEntityElement === $moduleEntity) {
                unset($this->moduleEntities[$key]);
                break;
            }
        }

        return $this;
    }
439215
private function restoreModuleInformation($module, $moduleId)
    {
        $this->_addExtensions($module);
        $metaDataVersion = $module->getMetaDataVersion();
        $metaDataVersion = $metaDataVersion == '' ? $metaDataVersion = "1.0" : $metaDataVersion; 
        if (version_compare($metaDataVersion, '2.0', '<')) {
            $this->_addModuleFiles($module->getInfo("files"), $moduleId);
        }
        $this->_addTemplateBlocks($module->getInfo("blocks"), $moduleId);
        $this->_addTemplateFiles($module->getInfo("templates"), $moduleId);
        $this->_addModuleSettings($module->getInfo("settings"), $moduleId);
        $this->_addModuleVersion($module->getInfo("version"), $moduleId);
        $this->_addModuleExtensions($module->getExtensions(), $moduleId);
        $this->_addModuleEvents($module->getInfo("events"), $moduleId);

        if (version_compare($metaDataVersion, '2.0', '>=')) {
            try {
                $this->setModuleControllers($module->getControllers(), $moduleId, $module);
            } catch (ModuleValidationException $exception) {
                print "[ERROR]: duplicate controllers:" . $exception->getMessage() ."\n";
            }
        }
    }
1300690
public function fillMissingParams($module, $moduleSettings)
    {
        // Set class properties if needed
        if (empty($module->slug)) {
            foreach ($moduleSettings as $key => $value) {
                $module->$key = $value;
            }

            $module->isLegacy = true;
        }

        return $module;
    }
754413
protected function removeNotUsedSettings($moduleSettings, $moduleId)
    {
        $moduleConfigs = array_keys($this->getModuleConfigs($moduleId));
        $moduleSettings = $this->parseModuleSettings($moduleSettings);

        $configsToRemove = array_diff($moduleConfigs, $moduleSettings);
        if (!empty($configsToRemove)) {
            $this->removeModuleConfigs($moduleId, $configsToRemove);
        }
    }
943583
public function getSetting( $sSettingName, $blUseModulePrefix = true )
    {
        return in_array( $sSettingName, $this->_aValidPaymorrowSettings )
            ? $this->_OxpsPaymorrowSettings_getSetting_parent( $sSettingName, true )
            : null;
    }
355796
public function setSettings(array $settings = []) : self
    {
        $this->settings = array_merge($this->settings, $settings);
        // loop through checking each setting
        foreach ($this->allowedSettings as $name => $allowed) {
            $this->validateSettings->__invoke($name, $this->settings[$name], $allowed);
        }

        return $this;
    }
1090307
public function addModuleToReset(ModuleContainerInterface $module)
    {
        $path = $module->getPath(['database', 'migrations']);
        $this->migrator->requireFiles($path, $this->migrator->getMigrationFiles($path));

        return $this;
    }
757214
public function handleOnModuleActivation(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canHandle($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        $templateBlocksData = $moduleSetting->getValue();

        foreach ($templateBlocksData as $templateBlockData) {
            $templateBlockExtension = $this->mapDataToObject($templateBlockData);
            $templateBlockExtension->setShopId($shopId);
            $templateBlockExtension->setModuleId($moduleId);

            $this->templateBlockExtensionDao->add($templateBlockExtension);
        }
    }
738450
private function dumpSingleProviderModulesFromVendor(array &$modulesList, $providerDir)
    {
        $directoryIterator = new \DirectoryIterator($providerDir);
        foreach ($directoryIterator as $libDir) {
            if ($libDir->isDot()) {
                continue;
            }
            //creates path to Module.php file
            $moduleSettingsFile = implode(DIRECTORY_SEPARATOR, [
                $providerDir, $libDir, 'module', self::MODULE_SETTINGS_FILE
            ]);

            if (!file_exists($moduleSettingsFile)) {
                continue;
            }

            $baseName = Text::camelize($libDir->getBasename());
            if (!isset($modulesList[$baseName])) {
                $modulesList[$baseName] = [
                    'className' =>  $baseName
                        . '\\'
                        . pathinfo(self::MODULE_SETTINGS_FILE, PATHINFO_FILENAME),
                    'path'  =>  $moduleSettingsFile
                ];
            }
        }
    }
221825
public function addModule(ModuleInterface ...$modules): ApplicationBuilder
    {
        foreach ($modules as $module) {
            $this->modules[] = $module;
        }

        return $this;
    }
58563
function setDependencies(\assegai\Server $server, ModuleContainer $modules)
	{
        $this->server = $server;
        $this->modules = $modules;
	}