public function addAttribute($attribute, $value)
    {
        // Escape special characters
        $value = Filter::filterAttribute($value);

        if ($this->isProperty($attribute)) {
            $this->addPropertyOnDemand($attribute, $value);
        } else {
            if ($this->hasAttribute($attribute)) {
                throw new LogicException(sprintf('The element already has "%s" attribute', $attribute));
            }

            $this->append(sprintf(' %s="%s"', $attribute, $value));
            $this->attributes[$attribute] = $value;
        }

        return $this;
    }
public function addAttribute($attribute, $value)
    {
        // Escape special characters
        $value = Filter::filterAttribute($value);

        if ($this->isProperty($attribute)) {
            $this->addPropertyOnDemand($attribute, $value);
        } else {
            if ($this->hasAttribute($attribute)) {
                throw new LogicException(sprintf('The element already has "%s" attribute', $attribute));
            }

            $this->append(sprintf(' %s="%s"', $attribute, $value));
            $this->attributes[$attribute] = $value;
        }

        return $this;
    }
public function addAttribute ( $ attribute , $ value ) { // Escape special characters $ value = Filter :: filterAttribute ( $ value ) ; if ( $ this -> isProperty ( $ attribute ) ) { $ this -> addPropertyOnDemand ( $ attribute , $ value ) ; } else { if ( $ this -> hasAttribute ( $ attribute ) ) { throw new LogicException ( sprintf ( 'The element already has "%s" attribute' , $ attribute ) ) ; } $ this -> append ( sprintf ( ' %s="%s"' , $ attribute , $ value ) ) ; $ this -> attributes [ $ attribute ] = $ value ; } return $ this ; }
Adds an attribute

@param string $attribute
@param string $value
@throws \LogicException If trying to set existing attribute
@return \Krystal\Form\NodeElement
Adds an attribute