src/ConfigurationResolver.php
public function resolve(array $configuration)
    {
        foreach ($this->definitions as $key => $def) {
            if (!isset($configuration[$key])) {
                if (isset($def['default'])) {
                    $configuration[$key] = is_callable($def['default'])
                        ? $def['default']($configuration)
                        : $def['default'];
                } elseif (empty($def['required'])) {
                    continue;
                } else {
                    $this->throwRequired($configuration);
                }
            }

            $this->checkType($def['valid'], $key, $configuration[$key]);

            if (isset($def['fn'])) {
                $def['fn']($configuration[$key], $configuration);
            }
        }

        return $configuration;
    }
public function resolve(array $configuration)
    {
        foreach ($this->definitions as $key => $def) {
            if (!isset($configuration[$key])) {
                if (isset($def['default'])) {
                    $configuration[$key] = is_callable($def['default'])
                        ? $def['default']($configuration)
                        : $def['default'];
                } elseif (empty($def['required'])) {
                    continue;
                } else {
                    $this->throwRequired($configuration);
                }
            }

            $this->checkType($def['valid'], $key, $configuration[$key]);

            if (isset($def['fn'])) {
                $def['fn']($configuration[$key], $configuration);
            }
        }

        return $configuration;
    }
Resolve and validate the passed configuration options.

@param array $configuration Associative array of configuration options that will be resolved and validated.

@return array Returns an associative array of the resolved and validated configuration options.
@throws \InvalidArgumentException.