public function set($attribute, $value = array())
        {
            if(is_array($attribute)) {
                $this->attributes = array();
                foreach($attribute as $k => $v) {
                    $this->set($k, $v);
                }
            } else {
                if($attribute instanceof \Thin\Html\Attributes) {
                    $this->attributes = $attribute->getArray();
                } else {
                    $attribute = strval($attribute);
                    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));
                        }
                    }

                    $this->attributes[$attribute] = array_unique($value);
                }
            }

            return $this;
        }
public function set($attribute, $value = array())
        {
            if(is_array($attribute)) {
                $this->attributes = array();
                foreach($attribute as $k => $v) {
                    $this->set($k, $v);
                }
            } else {
                if($attribute instanceof \Thin\Html\Attributes) {
                    $this->attributes = $attribute->getArray();
                } else {
                    $attribute = strval($attribute);
                    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));
                        }
                    }

                    $this->attributes[$attribute] = array_unique($value);
                }
            }

            return $this;
        }
public function set ( $ attribute , $ value = array ( ) ) { if ( is_array ( $ attribute ) ) { $ this -> attributes = array ( ) ; foreach ( $ attribute as $ k => $ v ) { $ this -> set ( $ k , $ v ) ; } } else { if ( $ attribute instanceof \ Thin \ Html \ Attributes ) { $ this -> attributes = $ attribute -> getArray ( ) ; } else { $ attribute = strval ( $ attribute ) ; 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 ) ) ; } } $ this -> attributes [ $ attribute ] = array_unique ( $ value ) ; } } return $ this ; }
Set the value or values of an attribute or an array thereof. Already existent attributes are overwritten.

@param string|array|\Thin\Html\Attributes $attribute The name of the attribute to set, 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 set attribute

@return \Thin\Html\Attributes Provides a fluent interface
Set the value or values of an attribute or an array thereof . Already existent attributes are overwritten .