code: public function addClass($class)
      {
          if (!$this->hasClass($class)) {
              $current = (string)$this['class'];
  
              if ($current !== ''
                  && substr($current, -1) !== ' '
              ) {
                  $this['class'] .= ' ';
              }
  
              $this['class'] .= $class;
          }
  
          return $this;
      }
docs: Add given class to current node
  
  @param    string $class Class name
  @return    SimpleDOM            Current node