Возвращает список конфигурационных файлов в виде:
[alias => source, ...].
@param IConfigSource $config конфигурация
@return array
184381
protected function getLocalConfigArrays(IConfigSource $config)
    {
        $src = $config->getSource();

        $result = [
            $config->getAlias() => $this->convertToArray($src)
        ];

        array_walk_recursive(
            $src,
            function ($value) use (&$result) {
                if ($value instanceof IConfigSource) {
                    $result[$value->getAlias()] = $this->convertToArray($value->getSource());
                }
            }
        );

        return $result;
    }
1333213
protected function processCSSConfig($config)
    {
        if (!ArrayLib::is_associative($config)) {
            return array_fill_keys(array_values($config), null); 
        }
        
        return $config;
    }
1090951
protected function parseConfig($config)
    {
        $parsed = [];

        foreach ($config as $key=>$value) {
            if ($value instanceof XType) {
                $parsed[$key] = $value;
                continue;
            }
            $parsed[$key] = $this->stringToType($value);
        }

        return $parsed;
    }
918936
private function getActionsOnResources($config)
    {
        $result = [];

        $resources = (array) Collection::get($config, 'resources', []);
        $actions = (array) Collection::get($config, 'actions', []);
        if (!isset($actions[0]) || !is_array($actions[0])) {
            $actions = [$actions];
        }

        $index = 0;
        foreach ($resources as $resource) {
            if ('!' === substr($resource, 0, 1)) {
                $resource = substr($resource, 1);
                $result[$resource] = [];
                continue;
            }

            $action = isset($actions[$index]) ? $actions[$index] : $actions[0];
            $result[$resource] = $this->getActions($action);
        }

        return $result;
    }
872546
public static function config($config = []) {
		if (!$config) {
			return ['rules' => static::$_rules];
		}
		foreach ($config as $key => $val) {
			if (isset(static::${'_' . $key})) {
				static::${'_' . $key} = $val + static::${'_' . $key};
			}
		}
	}
401729
protected function getRequestConfig(array $config) : array
    {
        if (!empty($this->defaultRequestOptions)) {
            $config = array_replace_recursive($this->defaultRequestOptions, $config);
        }

        return $config;
    }
752592
protected function loadConfig(array $config)
    {
        $this->config = $config;
        if (array_key_exists('namespaces', $config)) {
            $this->ns = $config['namespaces'];
        }

        $this->defaultContext = $this->getMandatoryKey('defaultContext', $config);

        foreach ($this->getMandatoryKey('data_sources', $config) as $source => $c) {
            if (!array_key_exists('type', $c)) {
                throw new \Tripod\Exceptions\ConfigException("No 'type' set for data source $source");
            }
            if (!array_key_exists('connection', $c)) {
                throw new \Tripod\Exceptions\ConfigException("No connection information set for data source $source");
            }
            $this->dataSources[$source] = $c;
        }

        $transactionConfig = $this->getMandatoryKey('transaction_log', $config);
        $this->tConfig['data_source'] = $this->getMandatoryKey('data_source', $transactionConfig, 'transaction_log');
        if (!isset($this->dataSources[$this->tConfig['data_source']])) {
            throw new \Tripod\Exceptions\ConfigException("Transaction log data source, " . $this->tConfig['data_source'] . ", was not defined");
        }
        $this->tConfig["database"] = $this->getMandatoryKey("database", $transactionConfig, 'transaction_log');
        $this->tConfig["collection"] = $this->getMandatoryKey("collection", $transactionConfig, 'transaction_log');

        // A 'pod' corresponds to a logical database
        $this->databases = $this->getMandatoryKey("stores", $config);
        $defaultDB = null;
        foreach ($this->databases as $storeName => $storeConfig) {
            $this->dbConfig[$storeName] = ["data_source" => $this->getMandatoryKey("data_source", $storeConfig)];
            if (isset($storeConfig['database']) && !empty($storeConfig['database'])) {
                $this->dbConfig[$storeName]["database"]=$storeConfig['database'];
            } else {
                $this->dbConfig[$storeName]["database"] = $storeName;
            }

            $this->cardinality[$storeName] = [];
            $this->indexes[$storeName] = [];
            $this->podConnections[$storeName] = [];
            if (isset($storeConfig["pods"])) {
                foreach ($storeConfig["pods"] as $podName => $podConfig) {
                    $dataSource = (isset($podConfig['data_source']) ? $podConfig['data_source'] : $storeConfig['data_source']);
                    $this->podConnections[$storeName][$podName] = $dataSource;

                    // Set cardinality, also checking against defined namespaces
                    if (array_key_exists('cardinality', $podConfig)) {
                        // Test that the namespace exists for each cardinality rule defined
                        $cardinality = $podConfig['cardinality'];
                        foreach ($cardinality as $qname => $cardinalityValue) {
                            $namespaces = explode(':', $qname);
                            // just grab the first element
                            $namespace  = array_shift($namespaces);

                            if (array_key_exists($namespace, $this->ns)) {
                                $this->cardinality[$storeName][$podName][] = $cardinality;
                            } else {
                                throw new \Tripod\Exceptions\ConfigException("Cardinality '{$qname}' does not have the namespace defined");
                            }
                        }
                    } else {
                        $this->cardinality[$storeName][$podName] = [];
                    }

                    $this->cardinality[$storeName][$podName] = array_key_exists("cardinality", $podConfig) ? $podConfig['cardinality'] : [];

                    // Ensure indexes are legal
                    if (array_key_exists("indexes", $podConfig)) {
                        $this->indexes[$storeName][$podName] = [];
                        foreach ($podConfig["indexes"] as $indexName => $indexFields) {
                            // check no more than 1 indexField is an array to ensure Mongo will be able to create compound indexes
                            if (count($indexFields) > 1) {
                                $fieldsThatAreArrays = 0;
                                foreach ($indexFields as $field => $fieldVal) {
                                    $cardinalityField = str_replace('.value', '', $field);
                                    if (!array_key_exists($cardinalityField, $this->cardinality[$storeName][$podName]) ||
                                        $this->cardinality[$storeName][$podName][$cardinalityField] != 1) {
                                        $fieldsThatAreArrays++;
                                    }
                                    if ($fieldsThatAreArrays > 1) {
                                        throw new \Tripod\Exceptions\ConfigException("Compound index $indexName has more than one field with cardinality > 1 - mongo will not be able to build this index");
                                    }
                                }
                            } // @codeCoverageIgnoreStart
                            // @codeCoverageIgnoreEnd

                            $this->indexes[$storeName][$podName][$indexName] = $indexFields;
                        }
                    }
                }
            }
            if (isset($storeConfig['batch_sizes'])) {
                foreach ([OP_TABLES, OP_SEARCH, OP_VIEWS] as $op) {
                    if (isset($storeConfig['batch_sizes'][$op]) && is_numeric($storeConfig['batch_sizes'][$op])) {
                        $this->batchSize[$op] = intval($storeConfig['batch_sizes'][$op]);
                    }
                }
            }
            $searchConfig = array_key_exists("search_config", $storeConfig) ? $storeConfig["search_config"] : [];
            $this->searchDocSpecs[$storeName] = [];
            if (!empty($searchConfig)) {
                $this->searchProviderClassName[$storeName] = $this->getMandatoryKey('search_provider', $searchConfig, 'search');
                // Load search doc specs if search_config is set
                $searchDocSpecs = $this->getMandatoryKey('search_specifications', $searchConfig, 'search');
                foreach ($searchDocSpecs as $spec) {
                    if (!isset($spec[_ID_KEY])) {
                        throw new \Tripod\Exceptions\ConfigException("Search document spec does not contain " . _ID_KEY);
                    }
                    if (!isset($spec['from']) || !in_array($spec['from'], $this->getPods($storeName))) {
                        throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"from\"]' property not set or references an undefined pod");
                    }
                    if (!isset($spec['filter'])) {
                        throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"filter\"]' property not set");
                    }

                    if (!isset($spec['fields']) && !isset($spec['joins'])) {
                        throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "' contains no 'fields' or 'joins' properties");
                    }

                    if($this->searchProviderClassName[$storeName] == SEARCH_PROVIDER_MONGO)
                    {
                        if(isset($spec['to_data_source']))
                        {
                            if(!isset($this->dataSources[$spec['to_data_source']]))
                            {
                                throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"to_data_source\"]' property references an undefined data source");
                            }
                        }
                        else
                        {
                            $spec['to_data_source'] = $storeConfig['data_source'];
                        }
                    }
                    $this->searchDocSpecs[$storeName][$spec[_ID_KEY]] = $spec;
                }
            }

            // Load view specs
            $viewSpecs = (array_key_exists("view_specifications",$storeConfig)) ? $storeConfig["view_specifications"] : [];
            $this->viewSpecs[$storeName] = [];
            foreach ($viewSpecs as $spec)
            {
                if(!isset($spec[_ID_KEY]))
                {
                    throw new \Tripod\Exceptions\ConfigException("View spec does not contain " . _ID_KEY);
                }
                if(!isset($spec['from']) || !in_array($spec['from'], $this->getPods($storeName)))
                {
                    throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"from\"]' property not set or references an undefined pod");
                }
                if(!isset($spec['joins']))
                {
                    throw new \Tripod\Exceptions\ConfigException('Could not find any joins in view specification - usecase better served with select()');
                }
                $this->ifCountExistsWithoutTTLThrowException($spec);
                if(isset($spec['to_data_source']))
                {
                    if(!isset($this->dataSources[$spec['to_data_source']]))
                    {
                        throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"to_data_source\"]' property references an undefined data source");
                    }
                }
                else
                {
                    $spec['to_data_source'] = $storeConfig['data_source'];
                }
                $this->viewSpecs[$storeName][$spec[_ID_KEY]] = $spec;
            }

            // Load table specs
            $tableSpecs = (array_key_exists("table_specifications",$storeConfig)) ? $storeConfig["table_specifications"] : [];
            $this->tableSpecs[$storeName] = [];
            foreach ($tableSpecs as $spec)
            {
                $this->validateTableSpec($spec);

                if(isset($spec['to_data_source']))
                {
                    if(!isset($this->dataSources[$spec['to_data_source']]))
                    {
                        throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"to_data_source\"]' property references an undefined data source");
                    }
                }
                else
                {
                    $spec['to_data_source'] = $storeConfig['data_source'];
                }

                $this->tableSpecs[$storeName][$spec[_ID_KEY]] = $spec;
            }
        }

    }
1323545
public static function formatTranslationConfig($config, KernelInterface $kernel)
    {
        $config = static::formatConfig($config);
        $config['file'] = $kernel->locateResource($config['file']);

        if (isset($config['translations']) && \is_array($config['translations'])) {
            /** @var array $translation */
            foreach ($config['translations'] as &$translation) {
                $translation['file'] = $kernel->locateResource($translation['file']);
            }
        }

        return $config;
    }
129434
protected function getConfig(array $config): array
    {
        $keys = [
            'auth_key',
            'secret',
            'app_id',
            'options',
            'host',
            'port',
            'timeout',
        ];

        foreach ($keys as $key) {
            if (!array_key_exists($key, $config)) {
                throw new InvalidArgumentException("Missing configuration key [$key].");
            }
        }

        foreach ($config['options'] as $option => $value) {
            if (is_null($value)) {
                unset($config['options'][$option]);
            }
        }

        return array_only($config, $keys);
    }
678597
public static List<AliasedDiscoveryConfig<?>> aliasedDiscoveryConfigsFrom(WanPublisherConfig config) {
        return asList(config.getAwsConfig(), config.getGcpConfig(), config.getAzureConfig(), config.getKubernetesConfig(),
                config.getEurekaConfig());
    }
495831
protected function processJSTemplateConfig($config)
    {
        $templates = [];
        
        foreach ($config as $key => $value) {
            
            if (is_integer($key)) {
                
                $templates[$value] = [
                    'vars' => $this->getJSVars(),
                    'id'   => $this->getHTMLID()
                ];
                
            } else {
                
                $templates[$key] = [
                    'vars' => $this->getJSTemplateVars(array_shift($value)),
                    'id'   => $this->getJSTemplateID(array_shift($value))
                ];
                
            }
            
        }
        
        return $templates;
    }
1137697
private function translateLabels(array $config): array
    {
        foreach ($config as $tagName => $tagConfig) {
            $config[$tagName]['label'] = $this->translator->trans(
                /** @Ignore */
                $tagConfig['label'],
                [],
                $this->translationDomain
            );
            $config[$tagName]['description'] = $this->translator->trans(
                /** @Ignore */
                $tagConfig['description'],
                [],
                $this->translationDomain
            );

            if (empty($tagConfig['attributes'])) {
                continue;
            }

            foreach ($tagConfig['attributes'] as $attributeName => $attributeConfig) {
                $config[$tagName]['attributes'][$attributeName]['label'] = $this->translator->trans(
                    /** @Ignore */
                    $attributeConfig['label'],
                    [],
                    $this->translationDomain
                );
            }
        }

        return $config;
    }
756021
protected function buildCssWithSass(array $config)
    {
        $bootstrapFile = $config['assets_dir'].'/stylesheets/_bootstrap.scss';
        if (true === isset($config['customize']['variables_file']) &&
            null !== $config['customize']['variables_file']) {
            $bootstrapFile = $config['customize']['bootstrap_output'];
        }

        $inputs = array(
            $bootstrapFile,
            __DIR__.'/../Resources/sass/form.scss'
        );
        if ('fa' === $config['icon_prefix']) {
            $inputs[] = $config['fontawesome_dir'].'/scss/font-awesome.scss';
        }

        return array(
            'inputs'  => $inputs,
            'filters' => array($config['css_preprocessor']),
            'output'  => $config['output_dir'].'css/bootstrap.css'
        );
    }
142799
protected function getConfig(array $config): array
    {
        $keys = ['app_id', 'app_secret'];

        foreach ($keys as $key) {
            if (!array_key_exists($key, $config)) {
                throw new InvalidArgumentException("Missing configuration key [$key].");
            }
        }

        return array_only($config, [
            'app_id',
            'app_secret',
            'default_access_token',
            'default_graph_version',
            'enable_beta_mode',
            'http_client_handler',
            'persistent_data_handler',
            'url_detection_handler',
        ]);
    }
816044
protected function getOptionsFromConfig(Config $config)
    {
        $options = $this->options;
        foreach (static::$mappingOptions as $option => $ossOption) {
            if (! $config->has($option)) {
                continue;
            }
            $options[$ossOption] = $config->get($option);
        }

        return $options;
    }
927475
public function load(IConfig $config = null) {
        if ( ! $config instanceof IConfig) {
            $config = $this->createConfig();
        }

        $configs = [];

        // load config from filesystem
        foreach ($this->getPaths() as $path) {
            $configs[] = $this->loadPath($path);
        }

        // load runtime config
        foreach ($this->getRuntimeConfigs() as $runtimeConfig) {
            $configs[] = $runtimeConfig;
        }

        $config->merge($this->processConfiguration($configs));

        return $config;
    }
1122458
protected function getConfig(array $config): array
    {
        if (!array_key_exists('profiles', $config)) {
            throw new InvalidArgumentException('Missing configuration key [profiles].');
        }

        foreach (array_get($config, 'profiles') as $profile) {
            $keys = ['sources', 'destinations', 'processor', 'namer'];

            foreach ($keys as $key) {
                if (!array_key_exists($key, $profile)) {
                    throw new InvalidArgumentException("Missing profile configuration key [$key].");
                }
            }
        }

        return $config;
    }