Add attribute to collection

@param Attribute $attribute

@return Attributes
540209
public function addAttribute(Attribute$attribute) : Attributes
	{
		$this->getItems();//max sure is array
		$this->attributes[$attribute->getName()] = $attribute;
		return $this;
	}
622108
public function add($attribute, ...$values)
    {
        foreach ($values as $value) {
            if ($this->has($attribute)) {
                $attribute = $this->resolveAttributeName($attribute);
                $this->attributes[$attribute] = $this->addAttributeValue($this->attributes[$attribute], $value);
            } else {
                $this->attributes[$attribute] = $value;
            }
            $this->batches->add(new Batch(Batch::TYPE['ADD'], $attribute, $value));
        }

        return $this;
    }
749131
public static function add_attributes($tag, $attributes) {
        $tag = self::remove_attributes($tag, array_keys($attributes));
        if (!preg_match('/^(<.*?)(>.*)$/s', $tag, $matches)) {
            return $tag;
        }
        $rv = $matches[1];
        foreach ($attributes as $name => $value) {
            $rv .= " $name=\"".s($value).'"';
        }
        $rv .= $matches[2];
        return $rv;
    }
29291
public function addAllowedRole($role, $attribute = 'access')
    {
        $roleStr = (string) $role;
        if (!isset($this->allowedRoles[$roleStr])) {
            $this->allowedRoles[$roleStr] = array();
        }
        $this->allowedRoles[$roleStr][(string) $attribute] = true;
        return $this;
    }
813901
public function attribute( $attribute, $value )
    {
        if ( null === $value )
        {
            unset( $this->attributes[ $attribute ] );
        } else {
            $this->attributes[ $attribute ] = $value;
        }

        return $this;
    }
470318
public function addMany(array $attributes)
    {
        if (count($attributes) > 0) {
            foreach($attributes as $name => $value) {
                $this->add($name, $value);
            }
        }

        return $this;
    }
1229243
public function forgetAttribute($attribute)
    {
        if ($attribute === 'class') {
            $this->classes = [];

            return $this;
        }

        if (isset($this->attributes[$attribute])) {
            unset($this->attributes[$attribute]);
        }

        return $this;
    }
927738
public function fill(array $attributes = [])
    {
        foreach ($attributes as $key => $value) {
            $this->setAttribute($key, $value);
        }

        return $this;
    }
11442
public function setAttribute(string $attribute, string $value = '')
    {
        $this->htmlAttributes->setAttribute($attribute, $value);

        return $this;
    }
775491
public function addAttributes( $attributes = array() )
	{
		foreach( $attributes as $key => $value )
		{
			if( $key == 'class' )
			{
				if( is_string( $value ) )
					$value	= explode( " ", $value );
				if( !is_array( $value ) && !( $value instanceof ArrayIterator ) )
					throw new InvalidArgumentException( 'Class attribute must be string, array or iterator' );
				foreach( $value as $class )
					$this->addClass( $class );
				continue;
			}
			else
				$this->attributes[$key]	= $value;
		}
	}
182554
public function addField(array $attributes)
    {
        $field = $this->fields()->create($attributes);

        $this->save();

        return $field;
    }
847089
public function add_attribute()
    {
        $allowed = $this->assignment->getAttributesAllowedArray();
        $ak = CollectionAttributeKey::getByID($_REQUEST['akID']);
        if (is_object($ak) && in_array($ak->getAttributeKeyID(), $allowed)) {
            $obj = $this->getAttributeJSONRepresentation($ak, 'add');
            $obj->pending = true;
            $obj->assets = array();
            $ag = ResponseAssetGroup::get();
            foreach ($ag->getAssetsToOutput() as $position => $assets) {
                foreach ($assets as $asset) {
                    if (is_object($asset)) {
                        // have to do a check here because we might be included a dumb javascript call like i18n_js
                        $obj->assets[$asset->getAssetType()][] = $asset->getAssetURL();
                    }
                }
            }
            Loader::helper('ajax')->sendResult($obj);
        }
    }
13403
public function set($attribute, $value)
    {
        if ($value === [] || $value === '' || $value === null) {
            return $this->reset($attribute);
        }

        if ($this->has($attribute)) {
            $attribute = $this->resolveAttributeName($attribute);
            $this->attributes[$attribute] = $value;
        } else {
            $this->attributes[$attribute] = $value;
        }
        $this->batches->add(new Batch(Batch::TYPE['REPLACE'], $attribute, $value));

        return $this;
    }
578480
public static function addAttribute($attribute, $value, $options = [])
    {
        if (!isset(self::$instance)) {
            return;
        }
        return self::$instance->addAttribute($attribute, $value, $options);
    }
972832
public function setAttributes(Array $attributes) {

		foreach($attributes as $k => $v) {
			$this->setAttribute($k, $v);
		}
		return $this;

	}
293661
public function addAttribute($attribute, $value)
    {
        $value = is_array($value) ? $value : [$value];

        if (!isset($this->attributes[$attribute])) {
            $this->attributes[$attribute] = [];
        }
        foreach ($value as $attrValue) {
            $this->attributes[$attribute][] = $attrValue;
        }

        return $this;
    }
461287
public function attr($attribute, $value)
    {
        $this->setOption(self::OPTION_METHOD, "attr");
        $this->setOption(self::OPTION_ATTR, $attribute);
        $this->setOption(self::OPTION_VALUE, $value);

        return $this;
    }