コード例 #1
0
 public function test_constructor()
 {
     /** === Test Data === */
     $FILE = PRJ_ROOT . '/' . Main_Test::FILE_CONFIG_JSON_NVC;
     /** === Call and asserts  === */
     $config = new Config($FILE);
     $this->assertTrue(is_array($config->getVars()));
     $this->assertEquals(5, count($config->getVars()), "Wrong count of vars in the test data.");
     $tmpls = $config->getTemplates();
     $this->assertTrue(is_array($tmpls));
     $this->assertEquals(4, count($tmpls), "Wrong count of valid templates in the test data.");
 }
コード例 #2
0
ファイル: ConfigGroup.php プロジェクト: nncsang/Kurogo
 public function addConfig(Config $config)
 {
     $this->configs[] = $config;
     $config->addConfig($this);
     $this->addVars($config->getVars());
     $this->addSectionVars($config->getSectionVars());
 }
コード例 #3
0
 /**
  * Merge other config object to the current.
  *
  * @param Config $other
  */
 public function merge(Config $other)
 {
     /* merge variables */
     foreach ($other->getVars() as $key => $value) {
         $this->vars[$key] = $value;
     }
     /* merge templates */
     foreach ($other->getTemplates() as $one) {
         $this->templates[] = $one;
     }
 }