function parse($file, $section = false, $sec = true) { self::$file = $file; if (!file_exists(self::$file)) { self::$file = false; return array(); } self::$ini = parse_ini_file(self::$file, $sec); if (!$section) { return self::$ini; } else { self::$section = $section; if (isset(self::$ini[$section])) { return self::$ini[$section]; } else { return array(); } } }
public function testDuplicates() { $iniObj = new ini("unitTest/files/withInlineCommentsAndQuotedValuesDuplicates.ini"); $this->assertEquals('blah blah', $iniObj->section("repo foo")->key("description")->getValue(), "Replacing of section failed? Lost key/values."); $this->assertEquals('yes', $iniObj->section("repo foo")->key("daemon")->getValue(), "Replacing of section failed? Lost key/values."); $this->assertEquals('"Dustin Pate"', $iniObj->section("repo foo")->key("owner")->getValue(), "Replacing of previous value failed?"); //$iniObj->save("unitTest/files/duplicate.ini"); }