protected function mergeDefaults(array $defaults, $level = '')
    {
        foreach ($defaults as $key => $value) {
            if (is_array($value)) {
                $original = $this->getIfExists(ltrim("$level.$key", "."));
                if (is_array($original)) {
                    $this->mergeDefaults($value, "$level.$key");
                } elseif ($original instanceof NoItemFoundMessage) {
                    $this->set(ltrim("$level.$key", "."), $value);
                }
            } else {
                if (!$this->exists(ltrim("$level.$key", "."))) {
                    $this->set(ltrim("$level.$key", "."), $value);
                }
            }
        }
    }
protected function mergeDefaults(array $defaults, $level = '')
    {
        foreach ($defaults as $key => $value) {
            if (is_array($value)) {
                $original = $this->getIfExists(ltrim("$level.$key", "."));
                if (is_array($original)) {
                    $this->mergeDefaults($value, "$level.$key");
                } elseif ($original instanceof NoItemFoundMessage) {
                    $this->set(ltrim("$level.$key", "."), $value);
                }
            } else {
                if (!$this->exists(ltrim("$level.$key", "."))) {
                    $this->set(ltrim("$level.$key", "."), $value);
                }
            }
        }
    }
protected function mergeDefaults ( array $ defaults , $ level = '' ) { foreach ( $ defaults as $ key => $ value ) { if ( is_array ( $ value ) ) { $ original = $ this -> getIfExists ( ltrim ( "$level.$key" , "." ) ) ; if ( is_array ( $ original ) ) { $ this -> mergeDefaults ( $ value , "$level.$key" ) ; } elseif ( $ original instanceof NoItemFoundMessage ) { $ this -> set ( ltrim ( "$level.$key" , "." ) , $ value ) ; } } else { if ( ! $ this -> exists ( ltrim ( "$level.$key" , "." ) ) ) { $ this -> set ( ltrim ( "$level.$key" , "." ) , $ value ) ; } } } }
Recursively merge defaults array and items array
@param array $defaults
@param string $level
Recursively merge defaults array and items array