src/SimpleDOM.php
public function addClass($class)
    {
        if (!$this->hasClass($class)) {
            $current = (string)$this['class'];

            if ($current !== ''
                && substr($current, -1) !== ' '
            ) {
                $this['class'] .= ' ';
            }

            $this['class'] .= $class;
        }

        return $this;
    }
public function addClass($class)
    {
        if (!$this->hasClass($class)) {
            $current = (string)$this['class'];

            if ($current !== ''
                && substr($current, -1) !== ' '
            ) {
                $this['class'] .= ' ';
            }

            $this['class'] .= $class;
        }

        return $this;
    }
Add given class to current node

@param    string $class Class name
@return    SimpleDOM            Current node