Пример #1
0
 protected function getUncached($class, $name, $sourceOptions, &$result, $suppress, &$tags)
 {
     $tags[] = "__{$class}";
     $tags[] = "__{$class}__{$name}";
     // If result is already not something to merge into, just return it
     if ($result !== null && !is_array($result)) {
         return $result;
     }
     // First, look through the override values
     foreach ($this->overrides as $k => $overrides) {
         if (isset($overrides[$class][$name])) {
             $value = $overrides[$class][$name];
             self::merge_low_into_high($result, $value, $suppress);
             if ($result !== null && !is_array($result)) {
                 return $result;
             }
         }
         if (isset($this->suppresses[$k][$class][$name])) {
             $suppress = $suppress ? array_merge($suppress, $this->suppresses[$k][$class][$name]) : $this->suppresses[$k][$class][$name];
         }
     }
     $nothing = null;
     // Then the manifest values
     foreach ($this->manifests as $manifest) {
         $value = $manifest->get($class, $name, $nothing);
         if ($value !== $nothing) {
             self::merge_low_into_high($result, $value, $suppress);
             if ($result !== null && !is_array($result)) {
                 return $result;
             }
         }
     }
     $sources = array($class);
     // Include extensions only if not flagged not to, and some have been set
     if (($sourceOptions & self::EXCLUDE_EXTRA_SOURCES) != self::EXCLUDE_EXTRA_SOURCES) {
         // If we don't have a fresh list of extra sources, get it from the class itself
         if (!array_key_exists($class, $this->extraConfigSources)) {
             $this->extraConfigSources[$class] = Object::get_extra_config_sources($class);
         }
         // Update $sources with any extra sources
         $extraSources = $this->extraConfigSources[$class];
         if ($extraSources) {
             $sources = array_merge($sources, $extraSources);
         }
     }
     $value = $nothing = null;
     foreach ($sources as $staticSource) {
         if (is_array($staticSource)) {
             $value = isset($staticSource[$name]) ? $staticSource[$name] : $nothing;
         } else {
             foreach ($this->staticManifests as $i => $statics) {
                 $value = $statics->get($staticSource, $name, $nothing);
                 if ($value !== $nothing) {
                     break;
                 }
             }
         }
         if ($value !== $nothing) {
             self::merge_low_into_high($result, $value, $suppress);
             if ($result !== null && !is_array($result)) {
                 return $result;
             }
         }
     }
     // Finally, merge in the values from the parent class
     if (($sourceOptions & self::UNINHERITED) != self::UNINHERITED && (($sourceOptions & self::FIRST_SET) != self::FIRST_SET || $result === null)) {
         $parent = get_parent_class($class);
         if ($parent) {
             $this->getUncached($parent, $name, $sourceOptions, $result, $suppress, $tags);
         }
     }
     return $result;
 }