public function addTable(string $key) : TomlBuilder
    {
        $this->exceptionIfKeyEmpty($key);
        $addPreNewline = $this->currentLine > 0 ? true : false;
        $keyParts = explode('.', $key);

        foreach ($keyParts as $keyPart) {
            $this->exceptionIfKeyEmpty($keyPart, "Table: \"{$key}\".");
            $this->exceptionIfKeyIsNotUnquotedKey($keyPart);
        }

        $line = "[{$key}]";
        $this->addTableKey($key);
        $this->append($line, true, false, $addPreNewline);

        return $this;
    }
public function addTable(string $key) : TomlBuilder
    {
        $this->exceptionIfKeyEmpty($key);
        $addPreNewline = $this->currentLine > 0 ? true : false;
        $keyParts = explode('.', $key);

        foreach ($keyParts as $keyPart) {
            $this->exceptionIfKeyEmpty($keyPart, "Table: \"{$key}\".");
            $this->exceptionIfKeyIsNotUnquotedKey($keyPart);
        }

        $line = "[{$key}]";
        $this->addTableKey($key);
        $this->append($line, true, false, $addPreNewline);

        return $this;
    }
public function addTable ( string $ key ) : TomlBuilder { $ this -> exceptionIfKeyEmpty ( $ key ) ; $ addPreNewline = $ this -> currentLine > 0 ? true : false ; $ keyParts = explode ( '.' , $ key ) ; foreach ( $ keyParts as $ keyPart ) { $ this -> exceptionIfKeyEmpty ( $ keyPart , "Table: \"{$key}\"." ) ; $ this -> exceptionIfKeyIsNotUnquotedKey ( $ keyPart ) ; } $ line = "[{$key}]" ; $ this -> addTableKey ( $ key ) ; $ this -> append ( $ line , true , false , $ addPreNewline ) ; return $ this ; }
Adds a table.

@param string $key Table name. Dot character have a special mean. e.g: "fruit.type"

@return TomlBuilder The TomlBuilder itself
Adds a table .