public function addClass($className)
    {
        if(strlen($className) < 1)
        {
            throw new HTMLTagException("Class name is empty");
        }

        if(!$this->hasClass($className))
        {
            $classes = $this->getClasses() . " " . $this->removeMultipleSpaces(trim($className));
            $this->setAttribute("class",trim($classes));
        }

        return $this;
    }
public function addClass($className)
    {
        if(strlen($className) < 1)
        {
            throw new HTMLTagException("Class name is empty");
        }

        if(!$this->hasClass($className))
        {
            $classes = $this->getClasses() . " " . $this->removeMultipleSpaces(trim($className));
            $this->setAttribute("class",trim($classes));
        }

        return $this;
    }
public function addClass ( $ className ) { if ( strlen ( $ className ) < 1 ) { throw new HTMLTagException ( "Class name is empty" ) ; } if ( ! $ this -> hasClass ( $ className ) ) { $ classes = $ this -> getClasses ( ) . " " . $ this -> removeMultipleSpaces ( trim ( $ className ) ) ; $ this -> setAttribute ( "class" , trim ( $ classes ) ) ; } return $ this ; }
Add a class name to the class attribute, this won't add duplicates.
@param   string  $className
@return  HTMLTag
@throws  HTMLTagException
Add a class name to the class attribute this won t add duplicates .