diff --git a/README.md b/README.md index e766fc5..39220bd 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,19 @@ Documentation: https://php.gt/docs/config *** - Build status + Build status - Code quality + Code quality - Code coverage + Code coverage + + + Current version + + + PHP.Gt/Config documentation ## Example usage: diff --git a/src/Config.php b/src/Config.php index fdc3c89..972ab91 100644 --- a/src/Config.php +++ b/src/Config.php @@ -24,7 +24,17 @@ public function setDefault( $filename ); - $this->kvp = array_merge($defaults, $this->kvp); + foreach($defaults as $section => $data) { + foreach($data as $key => $value) { + if(!isset($this->kvp[$section])) { + $this->kvp[$section] = []; + } + + if(!isset($this->kvp[$section][$key])) { + $this->kvp[$section][$key] = $value; + } + } + } } public function get(string $name):?string {