protected function setNode($node)
{
$allowedClasses = ['DOMElement', 'DOMText', 'DOMComment'];
if (!in_array(get_class($node), $allowedClasses)) {
throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of DOMElement, DOMText or DOMComment, %s given', __METHOD__, is_object($node) ? get_class($node) : gettype($node)));
}
$this->node = $node;
return $this;
}