Resolved dependencies for a key.

@param string $key
@param array  $params

@return object
@throws Exception
324184
public function make($key, $params = [])
    {
        if($this->aliasExist($key)) {
            return $this->make($this->aliases[$key], $params);
        }

        if(is_callable($key)) {
            return call_user_func_array($key, $this->resolveCallback($key, $params));
        }

        return $this->resolveClass($key, $params);
    }
1157731
public function get($key)
    {
        $tab = $this->adminTabs->get($key);

        if (null == $tab) {
            throw new \Exception('Required Tab is missing');
        }
        return $this->adminTabs->get($key);
    }
1282022
private function resolveCustom($key)
    {
        if (is_array($key)) {
            foreach ($key as $k => $v) {
                $this->resolveCustom($k);
            }
        } else {
            if (! in_array($key, $this->reserved)) {
                $this->customFields[] = $key;
            }
        }
    }
51356
public function addDependency(string $key, string $method): ComponentBuilder
    {
        $this->dependencies[$key] = $method;
        return $this;
    }
317724
protected function &resolveKey($key)
    {
        // check if the key is a compound key
        if (strpos($key, '.') !== false) {

            // key is compound, so split it into parts
            $parts = explode('.', $key);
            $config = &$this->config;

            // recurse into the config array using the key parts
            while (is_array($config) && ($part = array_shift($parts)) !== null) {
                if (!isset($config[$part]) && array_key_exists($part, $config)) {
                    throw new KeyDoesNotExistException($key);
                }
                $config = &$config[$part];
            }

            // if there are still key parts left, then the key doesn't exist
            if (count($parts) > 0) {
                throw new KeyDoesNotExistException($key);
            }

        } else {

            // key is not compound, so just check if it exists and get value
            if (!isset($this->config[$key]) && !array_key_exists($key, $this->config)) {
                throw new KeyDoesNotExistException($key);
            }
            $config = &$this->config[$key];

        }

        return $config;
    }
43144
protected static function throwParamException(
        array $params,
        string $key,
        \Throwable $exception
    ) {
        $message = $exception->getMessage();

        if (self::isDebug()) {
            echo(
                "\n<pre>\n"
                . "Param Error: " . $message
                . "\n key: {$key}"
                // . "\n params: " . Json::encode($params, JSON_PRETTY_PRINT, 3)
                . "\n params dump: " . var_export($params, true)
                . "\n</pre>\n"
            );
        }

        throw $exception;
    }
1295386
public function resolveCallback(Closure $callback, $params = [])
    {
        $reflectionParameter = new ReflectionFunction($callback);

        $dependencies = $reflectionParameter->getParameters();

        return $this->getDependencies($dependencies, $params);
    }
582501
public function resolveMethod($class, $method, $params = [], $isRoute = false)
    {
        $reflectionMethod = new ReflectionMethod($class, $method);

        $dependencies = $reflectionMethod->getParameters();

        return $this->getDependencies($dependencies, $params, $isRoute);
    }
921389
public function get($key, $default = null, $params = [])
    {
        $params = array_merge($this->_defaults, $params);

        foreach ($params['objects'] as $object) {
            if ($object && ($object instanceof ViewableData) && $object->$key) {
                return $object->$key;
            }
        }

        // Grab mapping from object
        $mapping = (array)Config::inst()->get('environment', 'mapping');
        $objects = array_reverse($params['objects'], true);

        foreach ($objects as $object) {
            if ($object && method_exists($object, 'config')) {
                $mapping = array_merge($mapping, (array)$object->config()->db_to_environment_mapping);
            }
        }

        $mapping = array_merge($mapping, $params['mapping']);

        if (isset($mapping[$key])) {
            $key = $mapping[$key];
        }

        // 1. Check cache for valid key and return if found
        if ($params['fromCache'] && array_key_exists($key, $this->_cache)) {
            return $this->_cache[$key] === null ? $default : $this->_cache[$key];
        }

        $value = $default;

        // The function to check the $_ENV vars
        $findInEnvironment = function ($key) use ($params) {
            $value = null;

            if (isset($_ENV[$key])) {
                $value = $_ENV[$key];
            }

            if (getenv($key)) {
                $value = getenv($key);
            }

            if (is_callable($params['parseEnvVarFn'])) {
                $value = call_user_func_array($params['parseEnvVarFn'], [$value, $key]);
            }

            return $value;
        };

        // If key has dots, check recursively
        if (strpos($key, '.')) {
            $keyParts = explode('.', $key);

            // First part of key can denote multiple classes separated by a pipe (or)
            $namespaces = explode('|', array_shift($keyParts));

            // 2. Check \Config class for original value
            foreach ($namespaces as $namespace) {
                // Do a callback to get a value from a function sent in (this is for checking SiteConfig)
                if (isset($params['beforeConfigNamespaceCheckCallbacks'][$namespace]) && is_callable($params['beforeConfigNamespaceCheckCallbacks'][$namespace])) {
                    $value = call_user_func_array($params['beforeConfigNamespaceCheckCallbacks'][$namespace],
                        [$keyParts, $key]);

                    if ($value !== null) {
                        break;
                    }
                }

                $config = Config::inst()->forClass($namespace);

                $value = $config->get(implode('.', $keyParts), $params['on']);

                // 3. If value not found explicitly, recursively get if array
                if (!$value && count($keyParts) > 1) {
                    $configKey = array_shift($keyParts);
                    $configValue = $config->get($configKey, $params['on']);

                    if (is_array($configValue)) {
                        $value = array_get($configValue, implode('.', $keyParts));
                    } else {
                        $value = $configValue;
                    }
                }

                if ($value !== null) {
                    break;
                }
            }

            // 4. Check environment for key explicitly
            if ($value === null) {
                $value = $findInEnvironment($key);
            }

            // 5. Otherwise check for key by namespace in environment
            if ($value === null && count($namespaces) > 1) {
                foreach ($namespaces as $namespace) {
                    $value = $findInEnvironment($namespace . '.' . implode('.', $keyParts));

                    if ($value !== null) {
                        break;
                    }
                }
            }

            // 6. Otherwise check for key recursively in environment
            if ($value === null && !empty($keyParts)) {
                foreach ($namespaces as $namespace) {
                    if (($first = $findInEnvironment($namespace)) && is_array($first)) {
                        $value = array_get($first, implode('.', $keyParts));

                        if ($value !== null) {
                            break;
                        }
                    }
                }

                // 7. Otherwise, check for key as is (without namespaces, a global override to assume)
                if ($value === null) {
                    $value = $findInEnvironment(implode('.', $keyParts));
                }
            }
        } else {
            // Or else check in $_ENV vars
            $value = $findInEnvironment($key);
        }

        if ($params['doCache']) {
            $this->_cache[$key] = $value;
        }

        return $value === null ? $default : $value;
    }
1216318
protected function checkMultipartParams( $params ) {
		foreach ( $params as $key => $val ) {
			if ( !is_array( $val ) ) {
				throw new Exception( "Parameter '$key' must be an array." );
			}
			if ( !in_array( $key, array_keys( $this->getParams() ) ) ) {
				throw new Exception( "Parameter '$key' is not already set on this request." );
			}
		}
	}
142366
public static function get($key, $params = array()) {
        if (static::$message === NULL) {
            static::setLanguage('en');
        }

        $rs = isset(static::$message[$key]) ? static::$message[$key] : $key;

        $names = array_keys($params);
        $names = array_map(array('\\PhalApi\\Translator', 'formatVar'), $names);

        return str_replace($names, array_values($params), $rs);
    }
525743
public function get($key)
    {
        if (!$this->has($key)) {
            throw new Exception(sprintf(Exception::STATS_KEY_NOT_EXISTS, $key));
        }

        return $this->getCachedStats()->offsetGet($key);
    }
976055
public static function getArray(
        array $params,
        string $key,
        $default = null
    ) {
        if (self::has($params, $key)) {
            return (array)$params[$key];
        }

        return $default;
    }
1118586
protected function getValue($key)
    {
        $getResult = $this->getClient()->get($key);

        if ($this->getClient()->getResultCode() === \Memcached::RES_NOTFOUND) {
            throw new KeyNotFoundException();
        } elseif ($getResult === false) {
            throw new \Exception($this->getClient()->getResultMessage(), $this->getClient()->getResultCode());
        }

        return $getResult;
    }
1121600
public static function getRequired(
        array $params,
        string $key,
        $context = null
    ) {
        self::assertHas($params, $key, $context);

        return $params[$key];
    }
143779
public function offsetGet($key)
    {
        if(array_key_exists($key, $this->resolved)) {
            return $this->resolved[$key];
        }

        return $this->make($key);
    }
1338613
public static function getInt(
        array $params,
        string $key,
        $default = null
    ) {
        if (self::has($params, $key)) {
            return (int)$params[$key];
        }

        return $default;
    }