public function add($attribute, $value = array())
        {
            if(is_array($attribute)) {
                foreach($attribute as $k => $v) {
                    $this->add($k, $v);
                }
            } else {
                if($attribute instanceof \Thin\Html\Attributes) {
                    $this->add($attribute->getArray());
                } else {
                    $attribute = strval($attribute);
                    if(!\Thin\Arrays::exists($attribute, $this->attributes)) {
                        $this->attributes[$attribute] = array();
                    }

                    if(is_array($value)) {
                        foreach($value as $k => $v) {
                            $value[$k] = strval($v);
                        }
                    } else {
                        if(empty($value) && $value !== '0') {
                            $value = array();
                        } else {
                            $value = array(strval($value));
                        }
                    }

                    foreach($value as $v) {
                        $this->attributes[$attribute][] = $v;
                    }
                    $this->attributes[$attribute] = array_unique($this->attributes[$attribute]);
                }
            }

            return $this;
        }
public function add($attribute, $value = array())
        {
            if(is_array($attribute)) {
                foreach($attribute as $k => $v) {
                    $this->add($k, $v);
                }
            } else {
                if($attribute instanceof \Thin\Html\Attributes) {
                    $this->add($attribute->getArray());
                } else {
                    $attribute = strval($attribute);
                    if(!\Thin\Arrays::exists($attribute, $this->attributes)) {
                        $this->attributes[$attribute] = array();
                    }

                    if(is_array($value)) {
                        foreach($value as $k => $v) {
                            $value[$k] = strval($v);
                        }
                    } else {
                        if(empty($value) && $value !== '0') {
                            $value = array();
                        } else {
                            $value = array(strval($value));
                        }
                    }

                    foreach($value as $v) {
                        $this->attributes[$attribute][] = $v;
                    }
                    $this->attributes[$attribute] = array_unique($this->attributes[$attribute]);
                }
            }

            return $this;
        }
public function add ( $ attribute , $ value = array ( ) ) { if ( is_array ( $ attribute ) ) { foreach ( $ attribute as $ k => $ v ) { $ this -> add ( $ k , $ v ) ; } } else { if ( $ attribute instanceof \ Thin \ Html \ Attributes ) { $ this -> add ( $ attribute -> getArray ( ) ) ; } else { $ attribute = strval ( $ attribute ) ; if ( ! \ Thin \ Arrays :: exists ( $ attribute , $ this -> attributes ) ) { $ this -> attributes [ $ attribute ] = array ( ) ; } if ( is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { $ value [ $ k ] = strval ( $ v ) ; } } else { if ( empty ( $ value ) && $ value !== '0' ) { $ value = array ( ) ; } else { $ value = array ( strval ( $ value ) ) ; } } foreach ( $ value as $ v ) { $ this -> attributes [ $ attribute ] [ ] = $ v ; } $ this -> attributes [ $ attribute ] = array_unique ( $ this -> attributes [ $ attribute ] ) ; } } return $ this ; }
Add an attribute or an array thereof. If the attribute already exists, the specified values will be added to it, without overwriting the previous ones. Duplicate values are removed.

@param string|array|\Thin\Html\Attributes $attribute The name of the attribute to add, a name-value array of attributes or an attributes object
@param string|array $value In case the first parametre is a string, value or array of values for the added attribute

@return \Thin\Html\Attributes Provides a fluent interface
Add an attribute or an array thereof . If the attribute already exists the specified values will be added to it without overwriting the previous ones . Duplicate values are removed .