public function addClass($class)
    {
        if (isset($this->attr['class'])) {
            $classes = explode(' ', $this->attr['class']);
            if (!in_array($class, $classes)) {
                $classes[] = $class;
            }

            $this->attr['class'] = implode(' ', $classes);
        } else {
            $this->attr['class'] = $class;
        }
    }
public function addClass($class)
    {
        if (isset($this->attr['class'])) {
            $classes = explode(' ', $this->attr['class']);
            if (!in_array($class, $classes)) {
                $classes[] = $class;
            }

            $this->attr['class'] = implode(' ', $classes);
        } else {
            $this->attr['class'] = $class;
        }
    }
public function addClass ( $ class ) { if ( isset ( $ this -> attr [ 'class' ] ) ) { $ classes = explode ( ' ' , $ this -> attr [ 'class' ] ) ; if ( ! in_array ( $ class , $ classes ) ) { $ classes [ ] = $ class ; } $ this -> attr [ 'class' ] = implode ( ' ' , $ classes ) ; } else { $ this -> attr [ 'class' ] = $ class ; } }
Add class to the "class" attribute.

@param string $class Class name
Add class to the class attribute .