/** * @param string $key * @return string|object */ public function get($key) { if (isset($this->overrideMap[$key])) { $value = $this->overrideMap[$key]; if (is_string($value) && class_exists($value)) { return new $value(); } else { return $value; } } return $this->originalMap->get($key); }
/** * @param string $key * @param bool $useGlobal * @return object|string */ public function get($key, $useGlobal = true) { if (!is_string($key)) { throw new Exceptions\InvalidKeyException($key); } if ($this->map->has($key) || $this->tryLoadLocal($key)) { return $this->map->get($key); } else { if ($useGlobal) { try { return $this->tryLoadGlobal($key); } catch (Exceptions\ImplementerNotDefinedException $e) { throw new Exceptions\ImplementerNotDefinedException($key); } } } throw new Exceptions\ImplementerNotDefinedException($key); }