This is a helper method to get a correct mapping from an array config. It's designed to take raw array config
to generate a correct format mapping for repeaters.

@param array $config

@return array
347353
public function getRepeaterMapping(array $config)
    {
        $mapping = ['data' => null];
        $mapping['data'] = $this->setRepeaters(null, null, $config);

        return $mapping;
    }
1035135
protected function getDsn(array $config)
    {
        return $this->hasDsnString($config) ? $this->getDsnString($config) : $this->getHostDsn($config);
    }
1159831
protected function getReadConfig( array $config )
	{
		$readConfig = $this->getReadWriteConfig( $config, 'read' );

		if ( isset( $readConfig['host'] ) && is_array( $readConfig['host'] ) )
			$readConfig['host'] = count( $readConfig['host'] ) > 1 ? $readConfig['host'][array_rand( $readConfig['host'] )] : $readConfig['host'][0];

		return $this->mergeReadWriteConfig( $config, $readConfig );
	}
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)];
    }
136957
public function loadFromArray(array $config)
    {
        if (isset($config['domains'])) {
            $this->loadDomainConfiguration($config);
        }

        if (isset($config['general'])) {
            $general = $config['general'];
            $generalConfig = $this->getParsedConfig(
                $general,
                $this->config,
                $this->yamlConfigMap,
                []
            );
            $this->setCache(CacheFactory::get($generalConfig['cacheType'], $generalConfig['cacheOptions']));
            unset($generalConfig['cacheType']);
            unset($generalConfig['cacheOptions']);
            $this->setParsedConfig($generalConfig);
        }

        return $this;
    }
559890
public function transform(string $config = ''): array
    {
        $parsed = [];
        if (!empty($config)) {
            $config = \parse_ini_string($config, true, INI_SCANNER_RAW);
            if (\is_array($config)) {
                $parsed = $this->processNode($config);
            }
        }
        return $parsed;
    }
143241
public static function convertRetry(array $config)
    {
        // TODO: add deprecation
        if (isset($config['curlCodes'])) {
            $config['curl'] = [];
            $config['curl']['codes'] = $config['curlCodes'];
            unset($config['curlCodes']);
        }

        if (isset($config['headerName']) || isset($config['httpCodes'])) {
            $config['http'] = [];

            if (isset($config['headerName'])) {
                $config['http']['retryHeader'] = $config['headerName'];
                unset($config['headerName']);
            }
            if (isset($config['httpCodes'])) {
                $config['http']['codes'] = $config['httpCodes'];
                unset($config['httpCodes']);
            }
        }

        return $config;
    }
71202
public static function get($config = array()) {
        $hash = md5(serialize($config));
        if (!isset(self::$_instances[$hash]))
            self::$_instances[$hash] = new static($config);
        return self::$_instances[$hash];
    }
388271
private function generateArray(array $config)
    {
        ++$this->indent;

        foreach ($config as $key => $value) {
            if (is_null($value)) {
                if (is_string($key)) {
                    $this->writeLine(sprintf("'%s' => %s,", $key, 'null'));
                } else {
                    $this->writeLine(sprintf('%s,', 'null'));
                }
            } elseif (is_bool($value)) {
                if (is_string($key)) {
                    $this->writeLine(sprintf("'%s' => %s,", $key, $value ? 'true' : 'false'));
                } else {
                    $this->writeLine(sprintf('%s,', $value ? 'true' : 'false'));
                }
            } elseif (is_string($value)) {
                if (is_string($key)) {
                    $this->writeLine(sprintf("'%s' => '%s',", $key, $value));
                } else {
                    $this->writeLine(sprintf("'%s',", $value));
                }
            } elseif (is_array($value)) {
                if (is_string($key)) {
                    $this->writeLine(sprintf("'%s' => [", $key));
                } else {
                    $this->writeLine('[');
                }

                $this->generateArray($value);

                $this->writeLine('],');
            } elseif ($value instanceof ClassName) {
                if (is_string($key)) {
                    $this->writeLine(sprintf("'%s' => %s,", $key, (string) $value));
                } else {
                    $this->writeLine(sprintf('%s,', (string) $value));
                }
            } else {
                if (is_string($key)) {
                    $this->writeLine(sprintf("'%s' => %s,", $key, $value));
                } else {
                    $this->writeLine($value.',');
                }
            }
        }

        --$this->indent;
    }
315558
protected function getOptions(array $config)
    {
        $options = [];

        if ($visibility = array_get($config, 'visibility')) {
            $options['visibility'] = $visibility;
        }

        if ($pirate = array_get($config, 'pirate')) {
            $options['disable_asserts'] = $pirate;
        }

        return $options;
    }
899813
public static function init($config = [])
    {
        $config = array_merge([
            'accepts' => [],
            'appendTo' => 'body',
            'showBar' => false,
            'editor' => Debugger::$editor,
            'maxDepth' => Debugger::$maxDepth,
            'maxLength' => Debugger::$maxLength,
            'scream' => true,
            'showLocation' => true,
            'strictMode' => true,
            'currentTime' => $_SERVER['REQUEST_TIME_FLOAT'] ?: microtime(true),
            'editorMapping' => isset(Debugger::$editorMapping) === true ? Debugger::$editorMapping : [],
        ], $config);

        Debugger::$editor = $config['editor'];
        Debugger::$maxDepth = $config['maxDepth'];
        Debugger::$maxLength = $config['maxLength'];
        Debugger::$scream = $config['scream'];
        Debugger::$showLocation = $config['showLocation'];
        Debugger::$strictMode = $config['strictMode'];
        Debugger::$time = $config['currentTime'];

        if (isset(Debugger::$editorMapping) === true) {
            Debugger::$editorMapping = $config['editorMapping'];
        }

        return $config;
    }
496436
protected function parseConfig(array $config): array
    {
        $result = [];
        foreach ($config as $key => $type) {
            if (\is_array($type)) {
                if ($arrayOfType = $this->factory->checkArrayOfType($type)) {
                    $result[$key] = $arrayOfType;
                } else {
                    $result[$key] = new self($type, $this->factory, $this->strict);
                }
            } elseif ($type instanceof CastInterface) {
                $result[$key] = $type;
            } else {
                $result[$key] = $this->factory->createType($type);
            }
        }

        return $result;
    }
574996
protected function convertScrapeConfig(array $config)
	{
		$config['extract'] = $this->convertRegexps($config['extract']);
		$config['match']   = $this->convertRegexps($config['match']);

		return $config;
	}
60792
protected function setConfig(array $config = array())
    {
        $this->config = $config;

        if (isset($config['prefix'])) {
            $this->prefix = $config['prefix'];
        }

        if (isset($config['host'])) {
            $this->host = $config['host'];
        }

        if (isset($config['port'])) {
            $this->port = $config['port'];
        }

        return $this;
    }
1367117
protected function normalizeConfig(array $config)
    {
        $hasVariantsConfigured = Arr::has($config, 'variants');

        $variantList = $this->castVariantsToVariantList(Arr::get($config, 'variants', []));

        if ( ! $hasVariantsConfigured || $this->shouldMergeDefaultVariants()) {
            $variantList->mergeDefault(config('paperclip.variants.default', []));
        }

        $extensions = $variantList->extensions();
        $urls       = $variantList->urls();

        Arr::set($config, 'variants', $variantList->variants());


        // Merge in extensions set through indirect means.
        if (count($extensions)) {
            Arr::set(
                $config,
                'extensions',
                array_merge(Arr::get($config, 'extensions', []), $extensions)
            );
        }

        // Merge in default URLs set through indirect means.
        if (count($urls)) {
            Arr::set(
                $config,
                'urls',
                array_merge(Arr::get($config, 'urls', []), $urls)
            );
        }

        return $config;
    }
151050
public static function configure(array $config)
    {
        static::$config = $config;

        if (is_null(static::$mounted)) {
            static::$mounted = static::mount($config['disk']['mount']);
        }

        return static::$mounted;
    }
893312
public function transform(string $config = ''): array
    {
        $parsed = [];
        if (!empty($config)) {
            $decoded = @\json_decode($config, true, 512);
            $parsed = $decoded !== null ? $decoded : [];
        }
        return $parsed;
    }