public function addContent($str, $index = null)
    {
        if (!is_null($index)) {
            $this->contents[$index] = $str;
        } else {
            $this->contents[] = $str;
        }
        return $this;
    }