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; }