Creates a custom instance of `ModuleConfig` with a parser, schema and
extra validation.

@param string $module Module.
@param string[] $options Options.
@return ModuleConfig Module Config.
971404
protected function getModuleConfig(string $module, array $options = []): ModuleConfig
    {
        $configFile = empty($options['configFile']) ? null : $options['configFile'];
        $mc = new ModuleConfig(ConfigType::MIGRATION(), $module, $configFile, ['cacheSkip' => true]);

        $schema = $mc->createSchema(['lint' => true]);
        $mc->setParser(new Parser($schema, ['lint' => true, 'validate' => true]));

        return $mc;
    }
593307
public function moduleConfig($module, $path)
    {
        $configArray = @include base_path(Config::get('cms.module-directory').'/'.ucfirst($module).'/config.php');

        if (!$configArray) {
            return config('cms.modules.'.$module.'.'.$path);
        }

        return self::assignArrayByPath($configArray, $path);
    }
125613
private function createModuleModels($module, $path)
    {
        $module_path = $path . $module;
        $module_path = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $module_path);

        $configGenerator = $this->getConfigGenerator($module_path);

        $this->buildModels($configGenerator);
        $this->buildSql($configGenerator);

        $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array(
            "module" => $module,
        ));
        $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR . "Config" .
            DIRECTORY_SEPARATOR . "config.php", true);
        $this->log->addLog("Generado config genérico para propel");
    }
1162136
protected function getModuleConfig(string $module, string $view, array $options = []): ModuleConfig
    {
        $mc = new ModuleConfig(ConfigType::VIEW(), $module, $view, ['cacheSkip' => true]);

        $schema = $mc->createSchema(['lint' => true]);
        $schema->setCallback(function (array $schema) use ($module) {
            //Add fields from migration file
            $schema = $this->addFieldsToSchema($schema, $module);
            //Add relation fields
            $schema = $this->addRelationToSchema($schema, $module);

            return $schema;
        });

        $mc->setParser(new Parser($schema, ['lint' => true, 'validate' => true]));

        return $mc;
    }
947415
protected function configureURL(array $options)
    {
        $url = $this->getEndPointUrl();
        if ($this->requiresOptions()) {
            $urlArr = explode("/",$url);
            $optional = FALSE;
            $optionNum = 0;
            $keys = array_keys($options);
            sort($keys);
            foreach($keys as $key){
                if (is_numeric($key)){
                    $optionNum = $key;
                    break;
                }
            }
            foreach($urlArr as $key => $urlPart){
                $replace = NULL;
                if (strpos($urlPart,static::$_URL_VAR_CHARACTER) !== FALSE){
                    if (strpos($urlPart,':') !== FALSE){
                        $optional = TRUE;
                        $replace = '';
                    }
                    $opt = str_replace(array(static::$_URL_VAR_CHARACTER,':'),'',$urlPart);
                    if (isset($options[$opt])){
                        $replace = $options[$opt];
                    }
                    if (isset($options[$optionNum]) && ($replace == '' || $replace == NULL)){
                        $replace = $options[$optionNum];
                        $optionNum = $optionNum+1;
                    }
                    if ($optional && $replace == ''){
                        $urlArr = array_slice($urlArr,0,$key);
                        break;
                    }
                    if ($replace !== NULL){
                        $urlArr[$key] = $replace;
                    }
                }
            }
            $url = implode("/",$urlArr);
            $url = rtrim($url,"/");
        }
        return $url;
    }
44667
public function update($module, $options = null)
    {
        $module = strtolower($module);
        $options = is_null($options) ? array() : $options;
        $modules = $this->findModules();
       
        // Resolve deps
        $deps = $this->resolveDependencies(
            $module
        );
        
        if (!$deps->offsetExists($module)) {
            $deps->offsetSet($module, 'X');
        }
        
        // Setup all dependencies
        foreach($deps as $depModule => $depVersion){

            if(!$this->hasSetupService($depModule)){
                continue;
            }
        
            $setup = $this->initSetupService($depModule);
            $operation = 'setup';
            $args = array();
        
            if ($depModule == $module) {
                $args['options'] = $options;
            }
             
            // complete existing installation
            $setup->exec(
                'setup',
                $args
            );
        }
        
        return true;
    }
188548
public static function create($options) {
        if (!is_array($options)) {
            $options = array();
        }

        $flags = isset($options['flags']) ? $options['flags'] : static::FLAG_BESTPERFORMANCE;

        $context = array(
            'flags' => array(
                'errorlog' => $flags & static::FLAG_ERROR_LOG,
                'exception' => $flags & static::FLAG_ERROR_EXCEPTION,
                'skippartial' => $flags & static::FLAG_ERROR_SKIPPARTIAL,
                'standalone' => $flags & static::FLAG_STANDALONEPHP,
                'noesc' => $flags & static::FLAG_NOESCAPE,
                'jstrue' => $flags & static::FLAG_JSTRUE,
                'jsobj' => $flags & static::FLAG_JSOBJECT,
                'jslen' => $flags & static::FLAG_JSLENGTH,
                'hbesc' => $flags & static::FLAG_HBESCAPE,
                'this' => $flags & static::FLAG_THIS,
                'nohbh' => $flags & static::FLAG_NOHBHELPERS,
                'parent' => $flags & static::FLAG_PARENT,
                'echo' => $flags & static::FLAG_ECHO,
                'advar' => $flags & static::FLAG_ADVARNAME,
                'namev' => $flags & static::FLAG_NAMEDARG,
                'spvar' => $flags & static::FLAG_SPVARS,
                'slash' => $flags & static::FLAG_SLASH,
                'else' => $flags & static::FLAG_ELSE,
                'exhlp' => $flags & static::FLAG_EXTHELPER,
                'lambda' => $flags & static::FLAG_HANDLEBARSLAMBDA,
                'mustlok' => $flags & static::FLAG_MUSTACHELOOKUP,
                'mustlam' => $flags & static::FLAG_MUSTACHELAMBDA,
                'mustsec' => $flags & static::FLAG_MUSTACHESECTION,
                'noind' => $flags & static::FLAG_PREVENTINDENT,
                'debug' => $flags & static::FLAG_RENDER_DEBUG,
                'prop' => $flags & static::FLAG_PROPERTY,
                'method' => $flags & static::FLAG_METHOD,
                'runpart' => $flags & static::FLAG_RUNTIMEPARTIAL,
                'rawblock' => $flags & static::FLAG_RAWBLOCK,
                'partnc' => $flags & static::FLAG_PARTIALNEWCONTEXT,
                'nostd' => $flags & static::FLAG_IGNORESTANDALONE,
                'strpar' => $flags & static::FLAG_STRINGPARAMS,
                'knohlp' => $flags & static::FLAG_KNOWNHELPERSONLY,
            ),
            'delimiters' => array(
                isset($options['delimiters'][0]) ? $options['delimiters'][0] : '{{',
                isset($options['delimiters'][1]) ? $options['delimiters'][1] : '}}',
            ),
            'level' => 0,
            'stack' => array(),
            'currentToken' => null,
            'error' => array(),
            'elselvl' => array(),
            'elsechain' => false,
            'tokens' => array(
                'standalone' => true,
                'ahead' => false,
                'current' => 0,
                'count' => 0,
                'partialind' => '',
            ),
            'usedPartial' => array(),
            'partialStack' => array(),
            'partialCode' => array(),
            'usedFeature' => array(
                'rootthis' => 0,
                'enc' => 0,
                'raw' => 0,
                'sec' => 0,
                'isec' => 0,
                'if' => 0,
                'else' => 0,
                'unless' => 0,
                'each' => 0,
                'this' => 0,
                'parent' => 0,
                'with' => 0,
                'comment' => 0,
                'partial' => 0,
                'dynpartial' => 0,
                'inlpartial' => 0,
                'helper' => 0,
                'delimiter' => 0,
                'subexp' => 0,
                'rawblock' => 0,
                'pblock' => 0,
                'lookup' => 0,
                'log' => 0,
            ),
            'usedCount' => array(
                'var' => array(),
                'helpers' => array(),
                'runtime' => array(),
            ),
            'compile' => false,
            'parsed' => array(),
            'partials' => (isset($options['partials']) && is_array($options['partials'])) ? $options['partials'] : array(),
            'partialblock' => array(),
            'inlinepartial' => array(),
            'helpers' => array(),
            'renderex' => isset($options['renderex']) ? $options['renderex'] : '',
            'prepartial' => (isset($options['prepartial']) && is_callable($options['prepartial'])) ? $options['prepartial'] : false,
            'helperresolver' => (isset($options['helperresolver']) && is_callable($options['helperresolver'])) ? $options['helperresolver'] : false,
            'partialresolver' => (isset($options['partialresolver']) && is_callable($options['partialresolver'])) ? $options['partialresolver'] : false,
            'runtime' => isset($options['runtime']) ? $options['runtime'] : '\\LightnCandy\\Runtime',
            'runtimealias' => 'LR',
            'safestring' => '\\LightnCandy\\SafeString',
            'safestringalias' => isset($options['safestring']) ? $options['safestring'] : 'LS',
            'rawblock' => false,
            'funcprefix' => uniqid('lcr'),
        );

        $context['ops'] = $context['flags']['echo'] ? array(
            'seperator' => ',',
            'f_start' => 'echo ',
            'f_end' => ';',
            'op_start' => 'ob_start();echo ',
            'op_end' => ';return ob_get_clean();',
            'cnd_start' => ';if ',
            'cnd_then' => '{echo ',
            'cnd_else' => ';}else{echo ',
            'cnd_end' => ';}echo ',
            'cnd_nend' => ';}',
        ) : array(
            'seperator' => '.',
            'f_start' => 'return ',
            'f_end' => ';',
            'op_start' => 'return ',
            'op_end' => ';',
            'cnd_start' => '.(',
            'cnd_then' => ' ? ',
            'cnd_else' => ' : ',
            'cnd_end' => ').',
            'cnd_nend' => ')',
        );

        $context['ops']['enc'] = $context['flags']['hbesc'] ? 'encq' : 'enc';
        $context['ops']['array_check'] = '$inary=is_array($in);';
        static::updateHelperTable($context, $options);

        if ($context['flags']['partnc'] && ($context['flags']['runpart'] == 0)) {
            $context['error'][] = 'The FLAG_PARTIALNEWCONTEXT requires FLAG_RUNTIMEPARTIAL! Fix your compile options please';
        }

        return $context;
    }
431679
public function options(string $module, string $controller): Link
    {
        return $this->addMap(RequestMethod::OPTIONS, $module, $controller);
    }
1161513
private function registerConfigNamespace(Module $module)
    {
        $files = $this->app['files']->files($module->getPath().'/Config');

        $package = $module->getName();

        foreach ($files as $file) {
            $filename = $this->getConfigFilename($file, $package);

            $this->mergeConfigFrom(
                $file,
                $filename
            );
        }
    }
1356384
public function make( $options ) {
		if ( is_string( $options ) ) {
			return $this->makeFromUrl( $options );
		}

		if ( is_array( $options ) ) {
			return $this->makeFromArray( $options );
		}

		if ( $options instanceof Closure ) {
			return $this->makeFromClosure( $options );
		}

		throw new ConfigurationException( 'Invalid condition options supplied.' );
	}
1295144
public function create(OptionsBag $options)
    {
        $connections = $this->parse($options);

        $class = $this->class;
        $memcache = new $class();

        return $this->configure($memcache, $connections);
    }
191273
public function setConfigs(array $options, $scope = null)
    {
        if (!is_null($scope)) {
            $this->registry[$scope] = $options;
        } else {
            $this->registry = $options;
        }

        return $this;
    }
906678
public function fromData(array $metaData): ModuleConfiguration
    {
        $this->validateParameterFormat($metaData);

        $this->validator->validate(
            $metaData[MetaDataProvider::METADATA_FILEPATH],
            $metaData[MetaDataProvider::METADATA_METADATA_VERSION],
            $metaData[MetaDataProvider::METADATA_MODULE_DATA]
        );

        $mappedData = $this->getMappedData(
            $metaData[MetaDataProvider::METADATA_MODULE_DATA],
            $metaData[MetaDataProvider::METADATA_PATH],
            $metaData[MetaDataProvider::METADATA_CHECKSUM]
        );

        $moduleConfiguration = new ModuleConfiguration();
        $moduleConfiguration
            ->setMetaDataCheckSum($mappedData[MetaDataProvider::METADATA_CHECKSUM])
            ->setId($mappedData[MetaDataProvider::METADATA_ID])
            ->setTitle($mappedData[MetaDataProvider::METADATA_TITLE])
            ->setDescription($mappedData[MetaDataProvider::METADATA_DESCRIPTION])
            ->setLang($mappedData[MetaDataProvider::METADATA_LANG])
            ->setThumbnail($mappedData[MetaDataProvider::METADATA_THUMBNAIL])
            ->setAuthor($mappedData[MetaDataProvider::METADATA_AUTHOR])
            ->setUrl($mappedData[MetaDataProvider::METADATA_URL])
            ->setEmail($mappedData[MetaDataProvider::METADATA_EMAIL])
            ->setSettings($mappedData[MetaDataProvider::METADATA_SETTINGS]);

        return $moduleConfiguration;
    }
30997
private static function getModuleFromDB($module){
        $data=Cache::get(md5("config_".$module));
        if(!$data){
            $config=self::get("config");
            $table=$config&&key_exists('db_table',$config)?$config['db_table']:"config";
            $module_key=$config&&key_exists('module_field',$config)?$config['module_field']:"module";
            $content=$config&&key_exists('content_field',$config)?$config['content_field']:"content";
            $data= Select::table($table)
                ->where($module_key,$module)
                ->value($content);
            Cache::set(md5("config_".$module),$data);
        }
        if($data){
            $data=json_decode($data,true);
        }
        return $data;
    }
1109243
public function install($module, $version, $options = null)
    {
        $module = strtolower($module);
        $options = is_null($options) ? array() : $options;
        
        $modules = $this->findModules();
        $current = array();
    
        foreach($modules as $name){
            $modVersion = $this->getModuleVersion($name);
            
            if ($modVersion) {
                $current[$name] = new SoftwareVersion(
                    $this->getModuleVersion($name));
            }
        }
        
        // Resolve deps
        $deps = $this->resolveDependencies(
            $module
        );
        
        if (!$deps->offsetExists($module)) {
            $deps->offsetSet($module, $version);
        }
        
        $queue = new PriorityQueue();
        
        // Setup all dependencies
        foreach($deps as $depModule => $depVersion){
            if(!$this->hasSetupService($depModule)){
                continue;
            }
    
            $setup = $this->initSetupService($depModule);
            $queue->insert(['service' => $setup, 'module' => $depModule], $setup->getPriority());
        }
        
        foreach ($queue->getIterator() as $datum) {
            $service    = $datum['service'];
            $depModule  = $datum['module'];
            $operation  = 'setup';
            $args       = array();
        
            if ($depModule == $module) {
                $args['options'] = $options;
            }
             
            // complete existing installation
            $service->exec(
                $operation,
                $args
            );
        }
        
        return true;
    }
1225954
public function addOptions($options)
    {
        if (is_array($this->options)) {
            $this->options = array_merge($this->options, $options);
        } else {
            $this->options = $options;
        }

        return $this;
    }
186811
public static function setConfig($options = []) {
		$config = $options + (array)Configure::read('Localization');
		foreach ($config as $key => $value) {
			$key = '_' . $key;
			if (!isset(static::${$key})) {
				continue;
			}
			static::${$key} = $value;
		}
	}