Add a css class.

@param string $className
772924
public function addClass($className)
    {
        $attr = $this->getAttribute('class');
        if ($attr != '') {
            $attr .= ' ';
        }
        $attr .= (string) $className;

        $this->setAttribute('class', $attr);
    }
1098066
public function hasClass($className)
    {
        if (!$class = $this->dom->getAttribute("class")) {
            return false;
        }

        $classes = explode(" ", $class);

        return in_array($className, $classes, true);
    }
792833
public function removeClass($className)
  {
    $pos = array_search($className, $this->classes);
    if (is_numeric($pos)) {
      unset($this->classes[$pos]);
      return true;
    }
    return false;
  }
604630
public function addClass( $className, $parameters = array() )
	{
		$object	= Alg_Object_Factory::createObject( $className, $parameters );
		$this->addObject( $object );
	}
1054267
public function addClass($class)
    {
        $current = preg_split('%\s+%', $this->getAttribute('class'), 0, PREG_SPLIT_NO_EMPTY);
        $added = preg_split('%\s+%', $class, 0, PREG_SPLIT_NO_EMPTY);
        $current = array_merge($current, $added);
        $classes = implode(' ', $current);

        $this->setAttribute('class', $classes);
    }
498820
public function setClassName($className)
    {
        Assert::stringNotEmpty($className, 'The class name must be a non-empty string. Got: %s');

        $pos = strrpos($className, '\\');

        if (false === $pos) {
            $this->namespaceName = '';
            $this->shortClassName = $className;
        } else {
            $this->namespaceName = substr($className, 0, $pos);
            $this->shortClassName = substr($className, $pos + 1);
        }

        return $this;
    }
1023353
function addClass ( el, className ) {
        if ( el.classList ) {
            el.classList.add(className);
        } else {
            el.className += ' ' + className;
        }
    }
1199473
function column_class($column, $classname) {
        if (isset($this->column_class[$column])) {
            $this->column_class[$column] = ' '.$classname; // This space needed so that classnames don't run together in the HTML
        }
    }
18300
public function submitMigration($className)
    {

        if ($this->direction == 'up') {
            if ($className::checkVersionUp($this->current, $this->target)) {
                $this->addMigration(new $className);
            }
        } elseif ($this->direction == 'down') {
            if ($className::checkVersionDown($this->current, $this->target)) {
                $this->addMigration(new $className);
            }
        }
    }
1249933
public function addClass(&$class)
    {
        if (isset($this->_classes[$class->name()])) {
            $phpdoctor =& $this->_root->phpdoctor();
            echo "\n";
            $phpdoctor->warning('Found class '.$class->name().' again, overwriting previous version');
        }
        $this->_classes[$class->name()] =& $class;
    }
675661
protected function addClass($cssClass, &$attributes)
    {
        $class = array_get($attributes, 'class', '');
        if (!str_contains($class, $cssClass)) {
            $class .= ' ' . $cssClass;
        }
        return array_set($attributes, 'class', $class);
    }
433457
protected function addClassOption($name, $value)
    {
        $value = trim($value);
        if (substr($value, 0, 1) == '.' || substr($value, 0, 1) == '#') {
            $value = substr($value, 1);
        }
        if ($value != '') {
            $this->addOption('class', $name, $value);
        }
    }
1249016
public function autoload($className)
    {
        if (0 === strpos($className, $this->prefix)) {
            $parts = explode('\\', substr($className, $this->prefixLength));
            $filepath = $this->directory.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $parts).'.php';

            if (is_file($filepath)) {
                require $filepath;
            }
        }
    }
348835
public function addStyleClass($styleClass)
    {
        $styleClass = (string)$styleClass;
        if (!in_array($styleClass, $this->styleClasses)) {
            array_push($this->styleClasses, $styleClass);
        }
        return $this;
    }
809072
public function setClassName(string $className): self
    {
        if (!class_exists($className)) {
            throw new \InvalidArgumentException(sprintf(
                'Class %s does not exist',
                $className
            ));
        }
        $this->className = $className;

        return $this;
    }
107660
public function removeClass($className)
    {
        $existingClasses = !empty($this->attributes['class'])
            ? explode(' ',$this->attributes['class'])
            : array();
        unset($existingClasses[array_search($className, $existingClasses)]);
        $this->attributes['class'] = implode(' ', $existingClasses);
    }
949404
public function addClass($className)
    {
        list($oldClassArray, $newClassArray) = $this->getClassArrays($className);

        $this->attributes['class'] = implode(array_unique(array_merge($oldClassArray, $newClassArray)), ' ');

        return $this;
    }