Adds the specified class(es) to each element in the set of matched elements.

@param string $name One or more space-separated classes to be added to the class attribute of each matched element.
@return HtmlPageCrawler $this for chaining
@api
546161
public function addClass($name)
    {
        foreach ($this as $node) {
            if ($node instanceof \DOMElement) {
                /** @var \DOMElement $node */
                $classes = preg_split('/\s+/s', $node->getAttribute('class'));
                $found = false;
                $count = count($classes);
                for ($i = 0; $i < $count; $i++) {
                    if ($classes[$i] == $name) {
                        $found = true;
                    }
                }
                if (!$found) {
                    $classes[] = $name;
                    $node->setAttribute('class', trim(join(' ', $classes)));
                }
            }
        }
        return $this;
    }
914799
public function addName(Name $name)
    {
        $names = array_map('strval', $this->names->toArray());
        if (!in_array($name->getName(), $names)) {
            $this->names->add($name);
            $name->setItem($this);
        }

        return $this;
    }
367944
public function setName($name)
    {
        if (in_array($name, self::$used_names)) {
            Throw new PageException(sprintf('The menuitem name "%s" is already in use.', $name));
        }

        $this->name = $name;

        // Store name to get safe that it's only used once
        self::$used_names[] = $name;

        return $this;
    }
156820
def add(name)
      if name =~ /\*/
        @patterns << make_pattern(name)
      elsif name =~ /^@browser$/i
        WEB_APIS.each do |cls|
          @class_names[cls] = true
        end
      else
        @class_names[name] = true
      end
    end
871874
protected function buildClass($name)
    {
        $stub = $this->getFiles()->get($this->getCommandDeclaredStubPath());

        return $this->replaceNamespace($stub, $name)
            ->replaceClassNameSingular($stub, $name)
            ->replaceClassNameLowerCase($stub, $name)
            ->replaceClassName($stub, $name)
            ->replaceModuleFolder($stub, $name)
            ->replaceClass($stub, $name)
            
            ->sanitizeStub($stub, $name);
    }
933171
public function setSelected(string $name)
    {
        $this->selected = ($this->name === $name);
        $this->children->setSelected($name);

        return $this;
    }
1069979
public function removeAttribute($name)
    {
        foreach ($this as $node) {
            if ($node instanceof \DOMElement) {
                /** @var \DOMElement $node */
                if ($node->hasAttribute($name)) {
                    $node->removeAttribute($name);
                }
            }
        }
        return $this;
    }
355523
public function add($name, $url)
    {
        $this->arguments[] = 'add';
        $this->arguments[] = $name;
        $this->arguments[] = $url;
        return $this;
    }
1179150
protected function buildClass($name)
    {
        $class = parent::buildClass($name);

        if ($this->option('markdown')) {
            $class = str_replace('DummyView', $this->option('markdown'), $class);
        }

        return $class;
    }
81129
public function addTextarea(string $name) : Element\Textarea
    {
        $textarea = new Element\Textarea($this, $name);
        $this->addComponent($name, $textarea);

        return $textarea;
    }
437268
protected function buildClass($name)
    {
        $stub = $this->files->get($this->getStub());

        return $this->replaceClassAndNamespace($name, $stub)->replaceFields($name, $stub);
    }
181149
public function setClass($name)
    {
        $this->name = $name;
        $this->wsdlfile = $this->wsdlFolder.$this->name.'.wsdl';
    }
949404
public function addClass($className)
    {
        list($oldClassArray, $newClassArray) = $this->getClassArrays($className);

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

        return $this;
    }
741471
public function addNameIfNotExists($name) {
    if (!isset($this->children[$name])) {
      $this->internalAddName($name);
    }
    return $this;
  }
547180
public function unsetElement($name)
    {
        if (isset($this->elements[$name])) {
            unset($this->elements[$name]);
        }

        return $this;
    }
220237
public function addCustomNodeClass(string $name, string $class): self{
        if(!is_subclass_of($class, NodeInterface::class)){
            throw new \InvalidArgumentException();
        }

        $this->customNodes[$name]   = $class;

        return $this;
    }
333566
public function group($name)
    {
        $this->_pointers['group'] = $name;
        $this->_menu[$this->_pointers['node']]['groups'][$name] = ['name' => $name, 'items' => []];
    
        return $this;
    }