Checks all requirements for the module
@param string $module_id
@return bool
@throws UnexpectedValueException
544003
public function checkRequirements($module_id)
    {
        $this->checkModuleId($module_id);
        $module = $this->module->getInfo($module_id);
        $this->checkCore($module);
        $this->checkPhpVersion($module);

        if ($this->module->isInstaller($module_id)) {
            $error = $this->translation->text('Modules with "installer" type cannot be installed/enabled when system is already set up');
            throw new UnexpectedValueException($error);
        }

        $this->checkDependenciesExtensions($module);
        $this->checkDependenciesModule($module_id);
        return true;
    }
958776
private static function validateRequiredData($id, $module, $category)
    {

        if(! is_string($id) || empty($id)) {
            throw new common_exception_InconsistentData('The module needs an id');
        }
        if(! is_string($module) || empty($module)) {
            throw new common_exception_InconsistentData('The module needs a path');
        }
        if(! is_string($category) || empty($category)) {
            throw new common_exception_InconsistentData('The module needs a category');
        }

        return true;
    }
1034235
function hasModule (name) {
    // throw error on invalid name
    requireValidName(name)
    // check if module exists
    return defined(immutable.modules[name]) ? true : false
}
1184328
public function verifyModuleStructure(){
		// Check Model Path
		$isValid = $this->verifyPath(dirname($this->getNames()->modelPath));
		
		// Check Entity Path
		$isValid = $isValid && $this->verifyPath(dirname($this->getNames()->entityPath));
		
		//$moduleFile = "{$this->getNames()->modulePath}/Module.php";
		
		return $isValid;
	}
1158635
function(obj, id) {
            if (!obj) {
                return;
            }

            if (typeof obj == 'function') {
                obj.prototype.__moduleId__ = id;
                return;
            }

            if (typeof obj == 'string') {
                return;
            }

            obj.__moduleId__ = id;
        }
1045370
public function getModuleById($moduleId)
    {
        foreach ($this->getModules() as $module) {
            if ($module->getModuleId() == $moduleId) {
                return $module;
            }
        }

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

        foreach ($moduleSetting->getValue() as $classToBePatched => $moduleClass) {
            if ($this->shopAdapter->isNamespace($classToBePatched)) {
                $this->validateClassToBePatchedNamespace($classToBePatched);
            }
        }
    }
527491
protected function checkModuleProperties()
    {
        // set use fields based on required fields
        if ($this->requireEmail) {
            $this->useEmail = true;
        }
        if ($this->requireUsername) {
            $this->useUsername = true;
        }

        // get class name for error messages
        $className = get_called_class();

        // check required fields
        if (!$this->requireEmail && !$this->requireUsername) {
            throw new InvalidConfigException("{$className}: \$requireEmail and/or \$requireUsername must be true");
        }
        // check login fields
        if (!$this->loginEmail && !$this->loginUsername) {
            throw new InvalidConfigException("{$className}: \$loginEmail and/or \$loginUsername must be true");
        }
        // check email fields with emailConfirmation/emailChangeConfirmation is true
        if (!$this->useEmail && ($this->emailConfirmation || $this->emailChangeConfirmation)) {
            $msg = "{$className}: \$useEmail must be true if \$email(Change)Confirmation is true";
            throw new InvalidConfigException($msg);
        }

        // ensure that the "user" component is set properly
        // this typically causes problems in the yii2-advanced app when people set it in
        // "common/config" instead of "frontend/config" and/or "backend/config"
        //   -> this results in users failing to login without any feedback/error message
        $userComponent = Yii::$app->get('user', false);
        if ($userComponent && !$userComponent instanceof \amnah\yii2\user\components\User) {
            throw new InvalidConfigException('Yii::$app->user is not set properly. It needs to extend \amnah\yii2\user\components\User');
        }
    }
812021
public function allowsMethod($method_id)
    {
        if (!$this->method_ids) {
            return false;
        }

        if (preg_match('/^[^:]+::[^:]+$/', $method_id)) {
            $method_stub = '*::' . explode('::', $method_id)[1];

            foreach ($this->method_ids as $config_method_id) {
                if ($config_method_id === $method_id) {
                    return true;
                }

                if ($config_method_id === $method_stub) {
                    return true;
                }

                if ($config_method_id[0] === '/' && preg_match($config_method_id, $method_id)) {
                    return true;
                }
            }

            return false;
        }

        return in_array($method_id, $this->method_ids);
    }
912058
public function checkPhpVersion(array $module)
    {
        if (!empty($module['php'])) {

            $components = $this->getVersionComponents($module['php']);

            if (empty($components)) {
                throw new UnexpectedValueException($this->translation->text('Failed to read PHP version'));
            }

            list($operator, $number) = $components;

            if (!version_compare(PHP_VERSION, $number, $operator)) {
                $error = $this->translation->text('Requires incompatible version of @name', array('@name' => 'PHP'));
                throw new UnexpectedValueException($error);
            }
        }

        return true;
    }
892161
public function editEditor($module_id, $file_id)
    {
        $this->setModuleEditor($module_id);
        $this->setFilePathEditor($file_id);
        $this->setTitleEditEditor();
        $this->setBreadcrumbEditEditor();
        $this->setMessageEditEditor();

        $this->setData('module', $this->data_module);
        $this->setData('can_save', $this->canSaveEditor());
        $this->setData('lines', count(file($this->data_file)));
        $this->setData('editor.content', file_get_contents($this->data_file));

        $this->submitEditor();
        $this->setJsSettingsEditor();
        $this->outputEditEditor();
    }
414453
public function validatePageCollectionItem($page_id)
    {
        $page = $this->page->get($page_id);

        if (empty($page['status'])) {
            return $this->translation->text('@name is unavailable', array('@name' => $this->translation->text('Page')));
        }

        return true;
    }
1044582
static function instance( $module_id ) {
			$key = 'm_' . $module_id;

			if ( ! isset( self::$_instances[ $key ] ) ) {
				self::$_instances[ $key ] = new FS_Plugin_Manager( $module_id );
			}

			return self::$_instances[ $key ];
        }
1218935
protected function maybeCheckTermExistsInDatabase($term_id)
    {
        if (!isset($this->config['checkExistence']) or false == $this->config['checkExistence']) {
            return;
        }
        $tableName = $this->grabPrefixedTableNameFor('terms');
        if (!$this->grabFromDatabase($tableName, 'term_id', ['term_id' => $term_id])) {
            throw new \RuntimeException("A term with an id of $term_id does not exist", 1);
        }
    }
170090
public function get($module_id)
    {
        $modules = $this->getList();
        return empty($modules[$module_id]) ? array() : $modules[$module_id];
    }
718220
public function disable($module_id)
    {
        try {
            $result = $this->canDisable($module_id);
        } catch (Exception $ex) {
            $result = $ex->getMessage();
        }

        $this->hook->attach("module.disable.before|$module_id", $result, $this);

        if ($result !== true) {
            return $result;
        }

        if ($this->module->isInstalled($module_id)) {
            $this->module->update($module_id, array('status' => false));
        } else {
            $this->module->add(array('status' => false, 'module_id' => $module_id));
        }

        $this->setOverrideConfig();

        $this->hook->attach("module.disable.after|$module_id", $result, $this);
        return $result;
    }
1110698
function modjewel_getModuleIdsRequired(moduleId) {
    var module = modjewel_getModule(moduleId)
    if (null == module) return null

    return module.moduleIdsRequired.slice()
}