public function add($key, $value)
    {
        $keys = explode('.', $key);
        $section = &$this->items;

        while (count($keys) > 1) {
            $key = array_shift($keys);

            if (! isset($section[$key])) {
                // If the key does not exist, we will set it to an empty array
                // and move into the next dimension.
                $section[$key] = [];
            } elseif (! is_array($section[$key])) {
                // If the item at this dimension is not an array, then we would
                // be overriding it if we continued any further. As the great
                // master programmer Yoda once said, exit we must.
                return;
            }

            $section = &$section[$key];
        }

        $key = array_shift($keys);

        if (! array_key_exists($key, $section)) {
            $section[$key] = $value;

            $this->notify();
        }
    }
public function add($key, $value)
    {
        $keys = explode('.', $key);
        $section = &$this->items;

        while (count($keys) > 1) {
            $key = array_shift($keys);

            if (! isset($section[$key])) {
                // If the key does not exist, we will set it to an empty array
                // and move into the next dimension.
                $section[$key] = [];
            } elseif (! is_array($section[$key])) {
                // If the item at this dimension is not an array, then we would
                // be overriding it if we continued any further. As the great
                // master programmer Yoda once said, exit we must.
                return;
            }

            $section = &$section[$key];
        }

        $key = array_shift($keys);

        if (! array_key_exists($key, $section)) {
            $section[$key] = $value;

            $this->notify();
        }
    }
public function add ( $ key , $ value ) { $ keys = explode ( '.' , $ key ) ; $ section = & $ this -> items ; while ( count ( $ keys ) > 1 ) { $ key = array_shift ( $ keys ) ; if ( ! isset ( $ section [ $ key ] ) ) { // If the key does not exist, we will set it to an empty array // and move into the next dimension. $ section [ $ key ] = [ ] ; } elseif ( ! is_array ( $ section [ $ key ] ) ) { // If the item at this dimension is not an array, then we would // be overriding it if we continued any further. As the great // master programmer Yoda once said, exit we must. return ; } $ section = & $ section [ $ key ] ; } $ key = array_shift ( $ keys ) ; if ( ! array_key_exists ( $ key , $ section ) ) { $ section [ $ key ] = $ value ; $ this -> notify ( ) ; } }
Add an item to the configuration if it does not already exist.

@param string $key
@param mixed $value
@return void
Add an item to the configuration if it does not already exist .