Parse config resource and build config array
@return array|ArrayObject
332692
protected function getArrayInternal()
    {
        if ($this->isArray($this->resource)) {
            return $this->resource;
        }

        return $this->parseJsonString($this->resource);
    }
26420
private function parseConfigFile()
    {
        $activeConfig = $this->getOriginalConfig();
        $activeConfig = $this->beforeExplode($activeConfig);

        //convert into an array
        $activeConfig = explode("\n", $activeConfig);

        $this->activeConfig = $this->afterExplode($activeConfig);

        return !empty($this->activeConfig);
    }
402851
public function parseData()
    {
        $data = [];
        $file1 = __DIR__.'/Config/App.php';
        $file2 = __DIR__.'/../Config/App.php';
        if (file_exists($file1)) {
            $data += require $file1;
        } elseif (file_exists($file2)) {
            $data += require $file2;
        } else {
            throw new \Exception("Error, while loading Config {$file1} file", 404);
        }

        return $data;
    }
181923
public function getConfig(): array
	{
		global $txt, $modSettings;

		$file = $this->_app->boardDir .'/_config'. $this->_app->name .'.json';

		// Already loaded or does not use config?
		if ($this->_config || !$this->_app->useConfig)
			return $this->_config;

		// Check for a $modSettings key first.
		if (!empty($modSettings['_config'. $this->_app->name]))
			return $this->_config = smf_json_decode($modSettings['_config'. $this->_app->name], true);

		// Get the json file. Must be located in $boarddir folder.
		if (!$this->_config && !file_exists($file))
		{
			loadLanguage('Errors');
			log_error(sprintf($txt['error_bad_file'], $file));
		}

		else
			$this->_config = smf_json_decode(file_get_contents($file), true);

		return $this->_config;
	}
1200978
public function getConfiguration()
    {
        $configurationFiles = $this->locator->locate('config.yml', null, false);
        $configurations     = [];

        foreach ($configurationFiles as $path) {
            $configurations[] = $this->loader->load($path);
        }

        return $this->processor->processConfiguration($this->configuration, $configurations);
    }
553049
protected function getConfig()
    {
        $config = array();
        $config['headers'] = $this->headers;
        $config['config'] = array(
            'curl' => $this->curlConfig
        );
        $config['query'] = $this->parameters;
        $config['cookies'] = true;
        return $config;
    }
838587
public function parse()
    {
        if (!is_array($this->paramList)) {
            return [];
        }

        $parsedParams = [];
        foreach ($this->paramList as $p) {
            $param = new ParsedParameter();
            $param->name = $p->name;
            $param->type = $this->getType($p->name, $this->paramAnnotations);
            $param->matchPattern = $this->getParamMatchType($param->type);
            try {
                $param->default = $p->getDefaultValue();
                if (is_bool($param->default)) {
                    $param->default = ($param->default===false) ? '0' : '1';
                }
                $param->required = false;
            } catch (\Exception $e) {
                $param->default = null;
                $param->required = true;
            }

            $parsedParams[] = $param;
        }

        return $parsedParams;
    }
1122136
public function get_builder_config() {
		$vars = Arr::except( get_object_vars( $this ),
			[ 'sections', 'containers', 'properties', 'builder', '_form' ]
		);

		return array_merge( $vars, $this->properties );
	}
340643
public function parse()
    {
        $templates = array();
        $finder = new Finder(); 
        
        $directories = array(
            $this->templatesDir, 
        );
        
        $globalResourcesFolder = $this->kernelDir . '/Resources/views/' . $this->themeName;
        if (is_dir($globalResourcesFolder)) {
            $directories[] = $globalResourcesFolder;
        }
        
        $templateFiles = $finder->files('*.twig')->in($directories);
        foreach ($templateFiles as $template) {
            $template = (string)$template;
            $templateName = basename($template);
            $templateContents = file_get_contents($template);
            
            $slots = $this->fetchSlots($templateContents);
            if (empty($slots)) {
                continue;
            }
            
            $templates[$templateName]['assets']['external_stylesheets'] = $this->fetchExternalStylesheets($templateContents);
            $templates[$templateName]['assets']['external_javascripts'] = $this->fetchExternalJavascripts($templateContents);
            $templates[$templateName]['assets']['external_stylesheets_cms'] = $this->fetchExternalStylesheetsCms($templateContents);
            $templates[$templateName]['assets']['external_javascripts_cms'] = $this->fetchExternalJavascriptsCms($templateContents);
            $templates[$templateName]['slots'] = $slots;
            if (strpos($template, $this->kernelDir) === false) {
                $templates[$templateName]['generate_template'] = dirname($template) == $this->templatesDir;
            }
        }
        
        return $templates;
    }
669225
protected function buildConfig()
    {
        if ($this->buildCache === null) {
            // Read the top config first:
            $built = [];
            $built = array_replace_recursive($built, $this->values['_top']);

            if (array_key_exists($this->environment, $this->values)) {
                $built = array_replace_recursive($built, $this->values[$this->environment]);
            }

            $this->buildCache = $built;
        }

        return $this->buildCache;
    }
624663
protected function _getFindConfig()
    {
        $config = (array)$this->config('findConfig') + ['conditions' => []];
        $config['conditions'] = array_merge($config['conditions'], $this->_request()->data);

        return $config;
    }
426313
private function parseSection(array $section)
    {
        $config = [];

        foreach ($section as $key => $value) {
            $this->parseKey($key, $value, $config);
        }

        return $config;
    }
156034
public function getConfig()
    {
        // Create default keys for the config
        $config = array_merge([
            'width'   => null,
            'height'  => null,
            'options' => null,
        ], $this->config);

        // Add crops
        if ($crop = $this->getAttributeValue('crop_box')) {
            if (!is_array($config['options'])) {
                $config['options'] = [];
            }
            $config['options']['trim_perc'] = [
                round($crop->x1, 4),
                round($crop->y1, 4),
                round($crop->x2, 4),
                round($crop->y2, 4),
            ];
        }

        // Return config
        return $config;
    }
127631
public function getConfigData()
    {
        $viewConfigPath = config('generator.path_view', base_path('resources/views/'));
        $viewBasePath = base_path('resources/views/');

        if ($viewBasePath === $viewConfigPath) {
            $viewPath = '';
        } else {
            $trans = array('/' => '.', $viewBasePath => '');
            $viewPath = strtr($viewConfigPath, $trans);
        }

        $routePrefix = config('generator.route_prefix', '');
        // check route prefix end with '.'
        if (strlen($routePrefix) > 0 && $routePrefix[strlen($routePrefix) - 1] !== '.') {
            $routePrefix .= '.';
        }

        return [
            'BASE_CONTROLLER'        => config('generator.base_controller', 'App\Http\Controllers\Controller'),

            'BASE_NAME'              => config('generator.base_name', 'App\Http\Request\Request'),

            'NAMESPACE_MODEL'        => config('generator.namespace_model', 'App\Models'),

            'NAMESPACE_MODEL_EXTEND' => config('generator.model_extend_class', 'Illuminate\Database\Eloquent\Model'),

            'NAMESPACE_CONTROLLER'   => config('generator.namespace_controller', 'App\Http\Controllers'),

            'NAMESPACE_REQUEST'      => config('generator.namespace_request', 'App\Http\Requests'),

            'NAMESPACE_REPOSITORY'   => config('generator.namespace_repository', 'App\Repositories'),

            'NAMESPACE_SERVICE'      => config('generator.namespace_service', 'App\Services'),

            'MAIN_LAYOUT'            => config('generator.main_layout', 'app'),

            'VIEW_PATH'              => $viewPath,

            'ROUTE_PREFIX'           => $routePrefix,
        ];
    }
596004
public function parse()
    {

        // load the deployment descriptors that has to be parsed
        $deploymentDescriptors = $this->loadDeploymentDescriptors();

        // parse the deployment descriptors from the conf.d and the application's META-INF directory
        foreach ($deploymentDescriptors as $deploymentDescriptor) {
            // query whether we found epb.xml deployment descriptor file
            if (file_exists($deploymentDescriptor) === false) {
                continue;
            }

            // validate the passed configuration file
            /** @var \AppserverIo\Appserver\Core\Api\ConfigurationService $configurationService */
            $configurationService = $this->getApplication()->newService('AppserverIo\Appserver\Core\Api\ConfigurationService');
            $configurationService->validateFile($deploymentDescriptor, null, true);

            // load the object manager instance
            /** @var \AppserverIo\Psr\Di\ObjectManagerInterface $objectManager */
            $objectManager = $this->getApplication()->search(ObjectManagerInterface::IDENTIFIER);

            // prepare and initialize the configuration node
            $webAppNode = new WebAppNode();
            $webAppNode->initFromFile($deploymentDescriptor);

            /** @var \AppserverIo\Appserver\Core\Api\Node\ServletNode $servletNode */
            foreach ($webAppNode->getServlets() as $servletNode) {
                // iterate over all configured descriptors and try to load object description
                /** \AppserverIo\Appserver\Core\Api\Node\DescriptorNode $descriptor */
                foreach ($this->getDescriptors() as $descriptor) {
                    try {
                        // load the descriptor class
                        $descriptorClass = $descriptor->getNodeValue()->getValue();

                        // load the object descriptor, initialize the servlet mappings and add it to the object manager
                        /** \AppserverIo\Psr\Deployment\DescriptorInterface $objectDescriptor */
                        if ($objectDescriptor = $descriptorClass::newDescriptorInstance()->fromConfiguration($servletNode)) {
                            /** @var \AppserverIo\Appserver\Core\Api\Node\ServletMappingNode $servletMappingNode */
                            foreach ($webAppNode->getServletMappings() as $servletMappingNode) {
                                // query whether or not we've to add the URL pattern for the servlet
                                if ((string) $servletNode->getServletName() === (string) $servletMappingNode->getServletName()) {
                                    $objectDescriptor->addUrlPattern((string) $servletMappingNode->getUrlPattern());
                                }
                            }

                            // add the object descriptor for the servlet
                            $objectManager->addObjectDescriptor($objectDescriptor, true);
                        }

                        // proceed with the next descriptor
                        continue;

                    // if class can not be reflected continue with next class
                    } catch (\Exception $e) {
                        // log an error message
                        $this->getApplication()->getInitialContext()->getSystemLogger()->error($e->__toString());

                        // proceed with the next descriptor
                        continue;
                    }
                }
            }

            // initialize the session configuration if available
            /** @var \AppserverIo\Appserver\Core\Api\Node\SessionConfigNode $sessionConfig */
            if ($sessionConfig = $webAppNode->getSessionConfig()) {
                foreach ($sessionConfig->toArray() as $key => $value) {
                    $this->getManager()->addSessionParameter($key, $value);
                }
            }

            // initialize the error page configuration if available
            /** @var \AppserverIo\Appserver\Core\Api\Node\ErrorPageNode $errorPageNode */
            foreach ($webAppNode->getErrorPages() as $errorPageNode) {
                $this->getManager()->addErrorPage((string) $errorPageNode->getErrorCodePattern(), (string) $errorPageNode->getErrorLocation());
            }

            // initialize the context with the context parameters
            /** @var \AppserverIo\Appserver\Core\Api\Node\ContextParamNode $contextParamNode */
            foreach ($webAppNode->getContextParams() as $contextParamNode) {
                $this->getManager()->addInitParameter((string) $contextParamNode->getParamName(), (string) $contextParamNode->getParamValue());
            }
        }
    }
359330
final public function getArray()
    {
        $res = $this->getArrayInternal();
        if (!$this->isArray($res) && !$this->isArrayObject($res)) {
            $errorMessage = 'AbstractDriver method _getArray() must return array or ArrayObject.';
            $errorMessage .= ' Make sure you have provided a valid config file path with file extension.';
            throw new ConfigException($errorMessage);
        }

        return StdObjectWrapper::toArray($res);
    }
950999
protected function parseGeneral()
    {
        // Read the config and merge it. (note: We use temp variables to prevent
        // "Only variables should be passed by reference")
        $tempconfig = $this->parseConfigYaml('config.yml');
        $tempconfiglocal = $this->parseConfigYaml('config_local.yml');
        $general = Arr::replaceRecursive($tempconfig, $tempconfiglocal);

        // Merge the array with the defaults. Setting the required values that aren't already set.
        $general = Arr::replaceRecursive($this->defaultConfig, $general);

        if (isset($general['accept_file_types']) === true) {
            if (is_array($general['accept_file_types']) === false) {
                // Make sure old settings for 'accept_file_types' are not still picked up. Before 1.5.4 we used to store them
                // as a regex-like string, and we switched to an array. If we find the old style, fall back to the defaults.
                unset($general['accept_file_types']);
            }

            // To remove unacceptable / unwanted extensions from the list of Acceptable File Types
            $removeFromAllowedFileTypes = explode('|', 'sh|asp|cgi|php|php3|ph3|php4|ph4|php5|ph5|phtm|phtml');

            // Create a bag with lowercased extensions
            $bag = Bag::from($general['accept_file_types']);
            $bag = $bag->map(function ($key, $ext) use ($removeFromAllowedFileTypes) {
                if (!in_array(mb_strtolower($ext), $removeFromAllowedFileTypes)) {
                    return mb_strtolower($ext);
                } else {
                    return null;
                }
            })->clean();

            $general['accept_file_types'] = array_values($bag->toArray());
        }

        // Make sure Bolt's mount point is OK:
        $general['branding']['path'] = '/' . Str::makeSafe($general['branding']['path']);

        // Set the link in branding, if provided_by is set.
        $general['branding']['provided_link'] = Html::providerLink(
            $general['branding']['provided_by']
        );

        $general['database'] = $this->parseDatabase($general['database']);

        return $general;
    }