public function visitConfigItem(ConfigItemBinding $configItem) { foreach ($configItem->getDependencies() as $dependency) { try { $dependency->accept($this); } catch (ConfigurationException $e) { throw new ConfigurationException($e->getMessage() . ", required by config " . $configItem->getKey()->getQualifier() . " in " . $configItem->getSource()); } } }
public function visitConfigItem(ConfigItemBinding $configItem) { $dependencies = $this->optimize($configItem->getDependencies()); if (count($dependencies) == 1) { $optimized = new ConstantValueBinding($configItem->getKey(), reset($dependencies)->getValue()); } else { $optimized = new ConfigItemBinding($configItem->getName(), $configItem->getSource(), $dependencies); } $this->bindings->put($optimized); return $optimized; }