Texy\HtmlElement::setText PHP Method

setText() final public method

Sets element's textual content.
final public setText ( $text ) : self
return self
    public final function setText($text)
    {
        if (is_scalar($text)) {
            $this->removeChildren();
            $this->children = [$text];
        } elseif ($text !== NULL) {
            throw new \InvalidArgumentException('Content must be scalar.');
        }
        return $this;
    }