public function set($path = null, $value = null)
	{
		if ($path === null) {
            $this->data = $value;
            return $this;
        }

        $at       =& $this->data;
        $keys     = explode(".", $path);
        $keyCount = count($keys);

        for ($i=0; $i < $keyCount; $i++) {
            if (($keyCount-1) === $i) {
                if (is_array($at)) {
                    $at[$keys[$i]] = $value;
                } else {
                    throw new \RuntimeException("Can not set value at this path ($path) because is not array.");
                }
            } else {
                $key = $keys[$i];
                if (!isset($at[$key])) {
                    $at[$key] = [];
                }
                $at =& $at[$key];
            }
        }

        return $this;
	}
public function set($path = null, $value = null)
	{
		if ($path === null) {
            $this->data = $value;
            return $this;
        }

        $at       =& $this->data;
        $keys     = explode(".", $path);
        $keyCount = count($keys);

        for ($i=0; $i < $keyCount; $i++) {
            if (($keyCount-1) === $i) {
                if (is_array($at)) {
                    $at[$keys[$i]] = $value;
                } else {
                    throw new \RuntimeException("Can not set value at this path ($path) because is not array.");
                }
            } else {
                $key = $keys[$i];
                if (!isset($at[$key])) {
                    $at[$key] = [];
                }
                $at =& $at[$key];
            }
        }

        return $this;
	}
public function set ( $ path = null , $ value = null ) { if ( $ path === null ) { $ this -> data = $ value ; return $ this ; } $ at = & $ this -> data ; $ keys = explode ( "." , $ path ) ; $ keyCount = count ( $ keys ) ; for ( $ i = 0 ; $ i < $ keyCount ; $ i ++ ) { if ( ( $ keyCount - 1 ) === $ i ) { if ( is_array ( $ at ) ) { $ at [ $ keys [ $ i ] ] = $ value ; } else { throw new \ RuntimeException ( "Can not set value at this path ($path) because is not array." ) ; } } else { $ key = $ keys [ $ i ] ; if ( ! isset ( $ at [ $ key ] ) ) { $ at [ $ key ] = [ ] ; } $ at = & $ at [ $ key ] ; } } return $ this ; }
Set new key for data, this can also
ovewrite existing data

@access public
@param string $key Key identifier
@param mixed $value Value assigned for key
Set new key for data this can also ovewrite existing data