示例#1
0
 /**
  * @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);
 }
示例#2
0
 /**
  * @param string $key
  * @return bool
  */
 public function has($key)
 {
     return isset($this->overrideMap[$key]) || $this->originalMap->has($key);
 }