src/LdapTools/ConfigurationParseTrait.php
protected function getParsedConfig(array $config, array $existingConfig, array $configMap, array $required)
    {
        $parsedConfig = [];

        foreach ($config as $key => $value) {
            $cfgKey = strtolower($key);
            if (!isset($configMap[$cfgKey])) {
                throw new ConfigurationException(
                    sprintf('Option "%s" not recognized.', $key)
                );
            }
            $parsedConfig[$configMap[$cfgKey]] = $value;
        }

        if (!$this->isParsedConfigValid($parsedConfig, $required)) {
            $needed = [];
            foreach ($required as $option) {
                $needed[] = array_search($option, $configMap);
            }
            throw new ConfigurationException(
                sprintf('Some required configuration options are missing. Required: %s', implode(', ', $needed))
            );
        }
        $existingConfig = array_merge($existingConfig, $parsedConfig);

        return array_filter($existingConfig, function ($v) {
            return $v !== null && $v !== '';
        });
    }
protected function getParsedConfig(array $config, array $existingConfig, array $configMap, array $required)
    {
        $parsedConfig = [];

        foreach ($config as $key => $value) {
            $cfgKey = strtolower($key);
            if (!isset($configMap[$cfgKey])) {
                throw new ConfigurationException(
                    sprintf('Option "%s" not recognized.', $key)
                );
            }
            $parsedConfig[$configMap[$cfgKey]] = $value;
        }

        if (!$this->isParsedConfigValid($parsedConfig, $required)) {
            $needed = [];
            foreach ($required as $option) {
                $needed[] = array_search($option, $configMap);
            }
            throw new ConfigurationException(
                sprintf('Some required configuration options are missing. Required: %s', implode(', ', $needed))
            );
        }
        $existingConfig = array_merge($existingConfig, $parsedConfig);

        return array_filter($existingConfig, function ($v) {
            return $v !== null && $v !== '';
        });
    }
protected function getParsedConfig ( array $ config , array $ existingConfig , array $ configMap , array $ required ) { $ parsedConfig = [ ] ; foreach ( $ config as $ key => $ value ) { $ cfgKey = strtolower ( $ key ) ; if ( ! isset ( $ configMap [ $ cfgKey ] ) ) { throw new ConfigurationException ( sprintf ( 'Option "%s" not recognized.' , $ key ) ) ; } $ parsedConfig [ $ configMap [ $ cfgKey ] ] = $ value ; } if ( ! $ this -> isParsedConfigValid ( $ parsedConfig , $ required ) ) { $ needed = [ ] ; foreach ( $ required as $ option ) { $ needed [ ] = array_search ( $ option , $ configMap ) ; } throw new ConfigurationException ( sprintf ( 'Some required configuration options are missing. Required: %s' , implode ( ', ' , $ needed ) ) ) ; } $ existingConfig = array_merge ( $ existingConfig , $ parsedConfig ) ; return array_filter ( $ existingConfig , function ( $ v ) { return $ v !== null && $ v !== '' ; } ) ; }
Parses a YAML config section and sends it back as the correct config values as an array.

@param array $config The YAML config section as an array.
@param array $existingConfig The config before merging the YAML config.
@param array $configMap The YAML to config key map array.
@param array $required The required options that must be in the array.
@return array The YAML config merged with the existing config.
@throws ConfigurationException
Parses a YAML config section and sends it back as the correct config values as an array .