public function attr($key, $value = null)
    {
        if(is_array($key))
        {
            foreach($key as $k => $val)
                $this->attributes[$k] = $val;

            return $this;
        }
        elseif($value === null)
        {
            $this->attributeString[] = $key;

            return $this;
        }

        if($key == 'class')
            return $this->addClass($value);

        $this->attributes[$key] = $value;

        return $this;
    }
public function attr($key, $value = null)
    {
        if(is_array($key))
        {
            foreach($key as $k => $val)
                $this->attributes[$k] = $val;

            return $this;
        }
        elseif($value === null)
        {
            $this->attributeString[] = $key;

            return $this;
        }

        if($key == 'class')
            return $this->addClass($value);

        $this->attributes[$key] = $value;

        return $this;
    }
public function attr ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ k => $ val ) $ this -> attributes [ $ k ] = $ val ; return $ this ; } elseif ( $ value === null ) { $ this -> attributeString [ ] = $ key ; return $ this ; } if ( $ key == 'class' ) return $ this -> addClass ( $ value ) ; $ this -> attributes [ $ key ] = $ value ; return $ this ; }
Set input attribute
@param array|string|null $key
@param string $value
@return $this
Set input attribute