Process configuration parameters to check key names, fix snake casing, etc..

@param array $config
@return array
433871
protected function processConfig(array $config)
    {
        return [
            'model'      => $config['model'],
            'table'      => $this->getModelTable($config['model']),
            'field'      => snake_case($config['field']),
            'key'        => snake_case($this->key($config['key'])),
            'foreignKey' => snake_case($this->key($config['foreignKey'])),
        ];
    }
1109087
private function getMergedConfigValues(array $config)
    {
        $mergedConfig = array();

        foreach ($config as $paymentConfig) {
            $mergedConfig[$paymentConfig->getName()] = $paymentConfig->getValue();
        }

        return $mergedConfig;
    }
261935
public static function getPanelNames(array $config) : array
    {
        if (empty($config[self::PANELS])) {
            return [];
        }

        return array_keys($config[self::PANELS]);
    }
877974
protected function formatS3Config(array $config)
    {
        $config += ['version' => 'latest'];

        if ($config['key'] && $config['secret']) {
            $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
        }

        return $config;
    }
1041946
public function config($config)
    {
        if (is_array($config)) {
            $this->config = array_merge($this->config, $config);
        } elseif (isset($this->config[$config])) {
            return $this->config[$config];
        } else {
            return;
        }
    }
1224131
protected function doSetup($config = array())
    {
        // Catch the configuration file path
        if (isset($config[self::CONFIG_KEY_FILE_PATH])) {
            $this->configFilePath = $config[self::CONFIG_KEY_FILE_PATH];
        } else {
            // Also consider throwing an exception here instead
            // of failing silently
            return $config;
        }

        // Catch the context
        if (isset($config[ConfigInterface::KEY_CONTEXT])) {
            $this->context = $config[ConfigInterface::KEY_CONTEXT];
        }

        return $this->readConfigurationFiles();
    }
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;
    }
329565
private function configureAuthentication(array $config)
    {
        $config['keyFile'] = $this->getKeyFile($config);
        $this->projectId = $this->detectProjectId($config);

        return $config;
    }
182483
public function config(array $config)
    {
        $this->validateConfig($config);


        if (array_key_exists('location', $config)) {
            $this->defaults->setLocation($config['location']);
        }

        if (array_key_exists('port', $config)) {
            $this->defaults->setPort($config['port']);
        }

        if (array_key_exists('headers', $config)) {
            $this->defaults->setHeaders($config['headers']);
        }

        if (array_key_exists('credentials', $config)) {
            $this->defaults->setCredentials(
                array_get($config['credentials'], 'name'),
                array_get($config['credentials'], 'password'),
                array_get($config['credentials'], 'domain')
            );
        }

        if (array_key_exists('method', $config)) {
            $this->defaults->setMethod($config['method']);
        }

        if (array_key_exists('parameters', $config)) {
            $this->defaults->setParameters($config['parameters']);
        }

        if (array_key_exists('body', $config)) {
            $this->defaults->setBody($config['body']);
        }

        if (array_key_exists('options', $config)) {
            $this->defaults->setOptions($config['options']);
        }

        return $this;
    }
239534
protected function normalizeConfig(array $config)
    {
        foreach ($this->configModel as $elmt => $settings) {
            if (!isset($config[$elmt])) {
                $config[$elmt] = $settings['default'];
            }
        }

        foreach ($config as $elmtName => $value) {
            if (!isset($this->configModel[$elmtName])) {
                unset($config[$elmtName]);
            }
        }

        return $config;
    }
304417
private function mergeConfigParams(array $config)
    {
        foreach ($config as $name => $value) {
            preg_match('/^extend~(.*)~(.*)$/', $name, $matches);

            if (3 === count($matches)) {
                if (!isset($config[$matches[1]])) {
                    throw new ConfigurationException(sprintf('Unable to find parameter "%s" for extending.', $matches[1]));
                }
                if (!is_array($config[$matches[1]])) {
                    throw new ConfigurationException(
                        sprintf('Unable to extend parameter "%s": only array parameters can be extended.', $matches[1])
                    );
                }

                $config[$matches[2]] = $this->mergeConfigs($config[$matches[1]], $value);

                unset($config[$name]);

                continue;
            }
            if (is_array($value)) {
                $config[$name] = $this->mergeConfigParams($value);
            }
        }

        return $config;
    }
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;
    }
1180954
protected function processSassConfiguration(array $config)
    {
        // changed from css_preprocessor to css_preprocessor for 3.0
        if (in_array($config['css_preprocessor'], array('sass', 'scssphp'))) {
            if ($config['assets_dir'] === Configuration::DEFAULT_ASSETS_DIR) {
                $config['assets_dir'] = Configuration::DEFAULT_ASSETS_DIR_SASS;
            }
            if ($config['customize']['bootstrap_output'] === Configuration::DEFAULT_BOOTSTRAP_OUTPUT) {
                $config['customize']['bootstrap_output'] = Configuration::DEFAULT_BOOTSTRAP_OUTPUT_SASS;
            }
            if ($config['customize']['bootstrap_template'] === Configuration::DEFAULT_BOOTSTRAP_TEMPLATE) {
                $config['customize']['bootstrap_template'] = Configuration::DEFAULT_BOOTSTRAP_TEMPLATE_SASS;
            }
        }

        return $config;
    }
297345
private function getParameters(array $config, $prefix)
    {
        $result = [];

        foreach ($config as $key => $value) {
            $index = sprintf('%s.%s', $prefix, $key);

            if (true === is_array($value)) {
                $result = array_merge($result, $this->getParameters($value, $index));
            } else {
                $result[$index] = $value;
            }
        }

        return $result;
    }
289360
public function params($config = array())
    {
        $config = new AnConfig($config);

        $config->append(array(
            'type' => 'component'
        ));

        $method = '_params'.ucfirst($config->type);
        return $this->$method($config);
    }
1274059
public static function getHPKPHeader(array $config): array
    {
        $headers = [];

        foreach ($config['hashes'] as $hash) {
            $headers[] = sprintf('pin-sha256="%s"', $hash);
        }

        $headers[] = sprintf('max-age=%d', $config['max-age']);

        if ($config['include-sub-domains']) {
            $headers[] = 'includeSubDomains';
        }

        if (! empty($config['report-uri'])) {
            $headers[] = sprintf('report-uri="%s"', $config['report-uri']);
        }

        $key = $config['report-only']
            ? 'Public-Key-Pins-Report-Only'
            : 'Public-Key-Pins';

        return [$key => implode('; ', $headers)];
    }
1140096
private function databaseFilter(array $config)
    {
        return [
            'driver'   => isset($config['driver'])   ? $config['driver']   : '',
            'name'     => isset($config['dbname'])   ? $config['dbname']   : '',
            'user'     => isset($config['user'])     ? $config['user']     : '',
            'password' => isset($config['password']) ? $config['password'] : '',
        ];
    }