QueryPath\DOMQuery::addClass PHP Метод

addClass() публичный Метод

This searchers for a class attribute on each item wrapped by the current DOMNode object. If no attribute is found, a new one is added and its value is set to $class. If a class attribute is found, then the value is appended on to the end.
См. также: css()
См. также: attr()
См. также: removeClass()
См. также: hasClass()
public addClass ( string $class )
$class string The name of the class.
    public function addClass($class)
    {
        foreach ($this->matches as $m) {
            if ($m->hasAttribute('class')) {
                $val = $m->getAttribute('class');
                $m->setAttribute('class', $val . ' ' . $class);
            } else {
                $m->setAttribute('class', $class);
            }
        }
        return $this;
    }