45 private $overrideData;
57 $this->reader = $reader;
58 $this->overrideData = $overrideData;
68 public function get($key =
null, $defaultValue =
null)
72 return $this->flatData;
74 return $this->flatData[$key] ?? $defaultValue;
99 if ($key !==
null && !isset($this->data[$key])) {
103 if (isset($this->data[$key])) {
104 return $this->data[$key];
129 return isset($this->data[
'db']);
137 private function load()
139 if (
null === $this->data) {
140 $this->data = $this->reader->load();
141 if ($this->overrideData) {
142 $this->data = array_replace($this->data, $this->overrideData);
145 $this->flatData = $this->flattenParams($this->data);
158 private function flattenParams(array
$params,
$path =
null)
162 foreach (
$params as $key => $param) {
164 $newPath =
$path .
'/' . $key;
168 if (isset(
$cache[$newPath])) {
169 throw new \Exception(
"Key collision {$newPath} is already defined.");
171 $cache[$newPath] = $param;
172 if (is_array($param)) {
173 $cache = array_merge(
$cache, $this->flattenParams($param, $newPath));
const CONFIG_PATH_INSTALL_DATE
__construct(DeploymentConfig\Reader $reader, $overrideData=[])
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]