Get settings and module id and starts import process.

Run module settings import logic only if it has settings array
On empty settings array, it will remove the settings.

@param object $module Module or Theme Object
489901
public function run($module)
    {
        $moduleSettings = $module->getInfo('settings');
        $isTheme = $this->isTheme($module->getId());
        if (!$isTheme || ($isTheme && is_array($moduleSettings))) {
            $this->addModuleSettings($moduleSettings, $module->getId());
        }
    }
1351712
protected function initContainer($module)
    {
        $map = [];

        $defaultClassMap = [

            /* MODELS */
            'Menu' => Menu::class,
            'MenuLang' => MenuLang::class,
            'Page' => Page::class,
            'PageLang' => PageLang::class,
            'PageItem' => PageItem::class,
            'PageItemLang' => PageItemLang::class,
            'PageSettings' => PageSettings::class,

            /* QUERIES */
            'MenuQuery' => MenuQuery::class,
            'MenuLangQuery' => MenuLangQuery::class,
            'PageQuery' => PageQuery::class,
            'PageLangQuery' => PageLangQuery::class,
            'PageItemQuery' => PageLangQuery::class,
            'PageItemLangQuery' => PageItemLangQuery::class,

            /* SEARCH */
            'PageSearch' => PageSearch::class
        ];

        $routes = [
            'mrstroz\\wavecms\\page\\models' => [
                'Menu',
                'MenuLang',
                'Page',
                'PageLang',
                'PageItem',
                'PageItemLang',
                'PageSettings',
            ],
            'mrstroz\\wavecms\\models\\page\\query' => [
                'MenuQuery',
                'MenuLangQuery',
                'PageQuery',
                'PageLangQuery',
                'PageItemQuery',
                'PageItemLangQuery',
            ],
            'mrstroz\\wavecms\\models\\page\\search' => [
                'PageSearch'
            ]
        ];

        $mapping = array_merge($defaultClassMap, $module->classMap);

        foreach ($mapping as $name => $definition) {
            $map[$this->getContainerRoute($routes, $name) . "\\$name"] = $definition;
        }

        $di = Yii::$container;

        foreach ($map as $class => $definition) {
            /** Check if definition does not exist in container. */
            if (!$di->has($class)) {
                $di->set($class, $definition);
            }
        }

    }
169634
public function setModule($value) {
		if (is_object($value)) {
			$this->module = get_class($value);
		}else {
			$this->module = (string) $value;
		}
	}
1205396
public function deleteAllByModule($module)
    {
        $query = sprintf('DELETE FROM `%s` WHERE `module` =:module', $this->table);

        $stmt = $this->pdo->prepare($query);
        return $stmt->execute(array(
            ':'.ConstProviderInterface::CONFIG_PARAM_MODULE => $module
        ));
    }
1294449
public function renderModule($module, $params = array(), $settings = array())
    {
        $style = null;

        if (is_object($module)) {
            $object = clone $module;
        } else {
            $object = new \stdClass();
        }
        if (!isset($object->published)) {
            $object->published = 1;
        }
        if (!is_object($module)) {
            $object->module = $module;
        }
        if (!isset($object->position)) {
            $object->position = '';
        }
        if (!isset($object->content)) {
            $object->content = '';
        }
        if (!isset($object->menuid)) {
            $object->menuid = '0';
        }
        if (!is_object($module)) {
            $object->name = preg_replace('/^mod_/', '', $module);
        }
        if (!isset($object->style)) {
            $object->style = null;
        }
        if (!isset($object->title)) {
            $object->title = '';
        }
        if (!isset($object->showtitle)) {
            $object->showtitle = '0';
        }

        if (isset($settings['title'])) {
            $object->title = $settings['title'];
            $object->showtitle = '1';
        }

        if (isset($settings['style'])) {
            $style = $object->style = $settings['style'];
        }

        if (isset($object->params)) {
            $params = array_merge(
                json_decode($object->params, true),
                $params
            );
        }

        $params = array_merge(array(
            'layout' => 'default',
            'moduleclass_sfx' => '',
            'cache' => 0,
            'cache_time' => 900,
            'cachemode' => 'itemid',
            'module_tag' => 'div',
            'bootstrap_size' => 0,
            'header_tag' => 'h2',
            'header_class' => '',
            'style' => '0'
        ), $params);

        $object->params = json_encode($params);

        $this->renderModuleObject($object, array(
            'style' => $style
        ));

        return $object->content;
    }
39055
private function getModuleFields(string $module) : array
    {
        $config = (new ModuleConfig(ConfigType::MIGRATION(), $module))->parse();
        $config = json_encode($config);
        if (false === $config) {
            return [];
        }

        $fields = json_decode($config, true);

        foreach ($fields as $k => $v) {
            $fields[$k] = new CsvField($v);
        }

        return $fields;
    }
1355852
public function update($module)
    {
        $module = $this->module->findOrFail($module);

        $packages = $module->get('require', []);

        chdir(base_path());

        foreach ($packages as $name => $version) {
            $package = "\"{$name}:{$version}\"";

            $this->run("composer require {$package}");
        }
    }
701738
public function addModule($module) {
        $this->registerModule($module);
        if (is_object($module)) $module = $module->name;
        $this->userModules[] = $module;
    }
125872
protected function js_module_loaded($module) {
        if (is_string($module)) {
            $modulename = $module;
        } else {
            $modulename = $module['name'];
        }
        return array_key_exists($modulename, $this->YUI_config->modules) ||
               array_key_exists($modulename, $this->extramodules);
    }
1138638
public function getAllByModule($module)
    {
        if (!$this->hasModule($module)) {
            return false;
        } else {
            $result = array();

            foreach ($this->data as $index => $row) {
                if (isset($row[ConstProviderInterface::CONFIG_PARAM_MODULE]) && $row[ConstProviderInterface::CONFIG_PARAM_MODULE] == $module) {
                    $name = $row[ConstProviderInterface::CONFIG_PARAM_NAME];
                    $value = $row[ConstProviderInterface::CONFIG_PARAM_VALUE];

                    $result[$name] = $value;
                }
            }

            return $result;
        }
    }
1157895
public static function initSubmodules($module)
    {
        $submodules = ArrayHelper::merge($module->modules, static::submodules($module));
        foreach ($submodules as $submoduleId => $submodule) {
            if (is_array($submodule)) $submodule = $module->getModule($submoduleId);
            if (empty($submodule)) continue;
            static::initSubmodules($submodule);
        }
    }
836821
public function add(Module $module)
    {
        $this->modules[$module->getName()] = $module;

        if ($module instanceof RootModule) {
            $this->rootModule = $module;
        }
    }
580230
private function setByModule(string $module) : void
    {
        $config = (new ModuleConfig(ConfigType::MODULE(), $module))->parse();
        $fields = $this->getModuleFields($module);

        if (! property_exists($config, 'table')) {
            return;
        }

        if (! property_exists($config->table, 'type')) {
            return;
        }

        if ('module' === $config->table->type) {
            $this->setByTypeModule($module, $fields);
        }

        if ('relation' === $config->table->type) {
            $this->setByTypeRelation($module, $fields);
        }

        if ($module === $this->getTableName()) {
            $this->setByTypeFile($module, $fields);
        }
    }
395658
public function setModule($module) {
        if (empty($module)) {
            throw new \Exception("Module cannot be empty", 0, null); //todo: create error code
        } else if (!is_string($module)) {
            throw new \Exception("Module must be a string", 0, null); //todo: create error code
        } else {
            $this->module = $module;
        }
    }
451985
public function setModule($module)
    {
        $this->module = is_string($module) ? $module : $this->$module;
        $this->prepareUrl();

        return $this;
    }
919490
public function setModule($module) {
        if (!is_string($module) || empty($module)) {
            $errMessage = "The module value must be a string and not be empty";
            throw new \InvalidArgumentException($errMessage, GeneralErrors::VALUE_IS_NOT_OF_EXPECTED_TYPE);
        }

        $this->module = $module;
    }
1070173
private function getIndexesByModule($module)
    {
        // Indexes to be removed
        $indexes = array();

        foreach ($this->data as $index => $row) {
            if (isset($row[ConstProviderInterface::CONFIG_PARAM_MODULE]) && $row[ConstProviderInterface::CONFIG_PARAM_MODULE] == $module) {
                array_push($indexes, $index);
            }
        }

        return $indexes;
    }