/** * {@inheritdoc} */ public function getApiTree($path = null) { $sections = empty($path) ? [] : explode('/', $path); array_unshift($sections, ProcessorDecorator::API_TREE_ROOT); $tree = $this->configBag->getConfig(); $rootSectionName = null; foreach ($sections as $section) { if (!isset($tree[$section])) { throw new ItemNotFoundException(sprintf('Config API section "%s" is not defined.', $path)); } $tree =& $tree[$section]; $rootSectionName = $section; } return $this->buildApiTree($rootSectionName === ProcessorDecorator::API_TREE_ROOT ? '' : $rootSectionName, $tree); }
public function testGetConfig() { $config = ['key' => 'value']; $configBag = new ConfigBag($config, $this->container); $this->assertEquals($config, $configBag->getConfig()); }