/** * @covers ConfigContainer::hasSection */ public function testHasSection() { $section_name = 'non-existent'; $this->assertFalse($this->object->hasSection($section_name)); $section = new ConfigSection($section_name); $this->object->addSection($section); $this->assertTrue($this->object->hasSection($section_name)); }
/** * Overrides secondary config variables by primary ones * * @param ConfigContainer $primary_config Overriding config * @param ConfigContainer $secondary_config Config to be overrided * @return \ConfigContainer Merged config */ private static function overrideConfigs(ConfigContainer $primary_config, ConfigContainer $secondary_config) { $config = new ConfigContainer(); $config->addSections($secondary_config->getSections()); foreach ($primary_config->getSections() as $section) { if ($config->hasSection($section->getSectionName())) { $config->getSection($section->getSectionName())->addVariables($section->getVariables()); } else { $config->addSection($section); } } return $config; }