private function parseImports(Config &$config, $file) { if (!isset($config->data['imports'])) { return; } if (!is_array($config->data['imports'])) { throw new \InvalidArgumentException(sprintf('The "imports" key should contain an array in %s. Check your YAML syntax.', $file)); } $defaultDirectory = dirname($file); foreach ($config->data['imports'] as $import) { if (!is_array($import)) { throw new \InvalidArgumentException(sprintf('The values in the "imports" key should be arrays in %s. Check your YAML syntax.', $file)); } $this->setCurrentDir($defaultDirectory); $sub_config = $this->import($import['resource'], null, isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false, $file); $config->addConfig($sub_config); unset($config->data['imports']); } }
public function addConfig(Config $config) { $this->data = array_replace_recursive($this->data, $config->data); $this->resources = array_merge($this->resources, $config->getResources()); }