src/Lego/Foundation/Button.php
public function attribute($name, $value, $merge = true)
    {
        if (!$merge) {
            $this->attributes[$name] = $value;

            return $this;
        }

        $current = array_get($this->attributes, $name);
        if (is_array($current) && is_array($value)) {
            $current = array_unique(array_merge($current, $value));
        } elseif (is_string($current) && is_string($value)) {
            $current = trim($current) . ' ' . trim($value);
        } else {
            $current = $value;
        }
        $this->attributes[$name] = $current;

        return $this;
    }
public function attribute($name, $value, $merge = true)
    {
        if (!$merge) {
            $this->attributes[$name] = $value;

            return $this;
        }

        $current = array_get($this->attributes, $name);
        if (is_array($current) && is_array($value)) {
            $current = array_unique(array_merge($current, $value));
        } elseif (is_string($current) && is_string($value)) {
            $current = trim($current) . ' ' . trim($value);
        } else {
            $current = $value;
        }
        $this->attributes[$name] = $current;

        return $this;
    }
public function attribute ( $ name , $ value , $ merge = true ) { if ( ! $ merge ) { $ this -> attributes [ $ name ] = $ value ; return $ this ; } $ current = array_get ( $ this -> attributes , $ name ) ; if ( is_array ( $ current ) && is_array ( $ value ) ) { $ current = array_unique ( array_merge ( $ current , $ value ) ) ; } elseif ( is_string ( $ current ) && is_string ( $ value ) ) { $ current = trim ( $ current ) . ' ' . trim ( $ value ) ; } else { $ current = $ value ; } $ this -> attributes [ $ name ] = $ current ; return $ this ; }
set html attribute.

@param $name
@param $value
@param bool $merge if true, new `value` will be merge to current `value`

@return $this
set html attribute .