public function addValue(string $key, $val, string $comment = '') : TomlBuilder
    {
        $this->currentKey = $key;
        $this->exceptionIfKeyEmpty($key);
        $this->addKey($key);

        if (!$this->isUnquotedKey($key)) {
            $key = '"'.$key.'"';
        }

        $line = "{$key} = {$this->dumpValue($val)}";

        if (!empty($comment)) {
            $line .= ' '.$this->dumpComment($comment);
        }

        $this->append($line, true);

        return $this;
    }
public function addValue(string $key, $val, string $comment = '') : TomlBuilder
    {
        $this->currentKey = $key;
        $this->exceptionIfKeyEmpty($key);
        $this->addKey($key);

        if (!$this->isUnquotedKey($key)) {
            $key = '"'.$key.'"';
        }

        $line = "{$key} = {$this->dumpValue($val)}";

        if (!empty($comment)) {
            $line .= ' '.$this->dumpComment($comment);
        }

        $this->append($line, true);

        return $this;
    }
public function addValue ( string $ key , $ val , string $ comment = '' ) : TomlBuilder { $ this -> currentKey = $ key ; $ this -> exceptionIfKeyEmpty ( $ key ) ; $ this -> addKey ( $ key ) ; if ( ! $ this -> isUnquotedKey ( $ key ) ) { $ key = '"' . $ key . '"' ; } $ line = "{$key} = {$this->dumpValue($val)}" ; if ( ! empty ( $ comment ) ) { $ line .= ' ' . $ this -> dumpComment ( $ comment ) ; } $ this -> append ( $ line , true ) ; return $ this ; }
Adds a key value pair

@param string $key The key name
@param string|int|bool|float|array|Datetime  $val The value
@param string $comment Comment (optional argument).

@return TomlBuilder The TomlBuilder itself
Adds a key value pair