Зафиксировать изменение атрибута
Если новое значение эквиалентно исходному, то признак изменения убирается
@param string $attr_name Названия атрибута
@param mixed $new_value Новое значение
960589
function change($attr_name, $new_value)
    {
        if (!$this->is_changed($attr_name)){
            $this->_changes[$attr_name] = $this->_attributes[$attr_name];
        }else
        if ($this->_changes[$attr_name] === $new_value){
            unset($this->_attributes[$attr_name]);
        }
        $this->_attributes[$attr_name] = $new_value;
    }
47057
public function SetAttribute($Name, $Value = '') {
      if (!is_array($Name))
         $Name = array($Name => $Value);

      foreach($Name as $Key => $Val) {
         if ($Val === NULL)
            unset($this->_Attributes[$Key]);
         $this->_Attributes[$Key] = $Val;
      }
   }
306086
public function setAttribute( $attr, $value ) {
        //value is the text node
        //we add this for the sake of consistency amongst other form elements
        if( strtolower( $attr ) == 'value' ) {
           $this->setText( $value );
        } else {
            parent::setAttribute( $attr, $value );
        }
    }
799666
protected function _elementTpl($name, $value = '', $id = '', $text = '', array $attrs = array())
    {
        $alias    = Str::slug($value, true);
        $inpClass = $this->_jbSrt('val-' . $alias);
        $input    = $this->input($name, $value, $id, $inpClass, $attrs);

        if ($this->_tpl === 'default') {
            return $input . $this->label($id, $alias, $text);
        } elseif ($this->_tpl === 'wrap') {
            return $this->label($id, $alias, $input . ' ' . $text);
        }

        if (is_callable($this->_tpl)) {
            return call_user_func($this->_tpl, $this, $name, $value, $id, $text, $attrs);
        }

        return null;
    }
1069760
public function setValue($new_value) {
    if (gettype($new_value) !== 'object') {
      return parent::setValue($new_value);
    }

    $new_props = $this->getSetProps($new_value);

    foreach ($new_props as $new_prop) {
      $this->setProp($new_prop, $new_value->{$new_prop});
    }

    return $this;
  }
457654
public function setValue($attribute_name, $attribute_value)
    {
        $value_holder = $this->getValueHolderFor($attribute_name);

        $this->validation_results->setItem(
            $attribute_name,
            $value_holder->setValue($attribute_value, $this)
        );

        return $this->isValid();
    }
688015
public function ulAttr($attr, $value = '')
    {
        if (func_num_args() > 1) {
            $this->optionUlAttr[$attr] = $value;
        } elseif (is_array($attr)) {
            $this->optionUlAttr = $attr;
        }else if (is_callable($attr)) {
            $this->optionUlAttr['callback'] = $attr;
        }

        return $this;
    }
1013822
def __new_attr(self, name, attr):
        
        if isinstance(attr, Pref):
            # Child attribute already has a Pref wrapping
            if VERBOSE_PREF:
                print('[pref.__new_attr]: %s.%s = %r' % (self._intern.name, name, attr.value()))
            new_childx = len(self._tree.child_names)
            # Children know about parents
            attr._tree.parent = self     # Give child parent
            attr._intern.name = name     # Give child name
            if attr._intern.depeq is None:
                attr._intern.depeq = self._intern.depeq  # Give child parent dependencies
            if attr._intern.hidden:
                self._tree.hidden_children.append(new_childx)
                self._tree.hidden_children.sort()
            # Used for QTIndexing
            attr._intern.aschildx = new_childx
            # Parents know about children
            self._tree.child_names.append(name)  # Add child to tree
            self._tree.child_list.append(attr)
            self.__dict__[name] = attr.value()   # Add child value to dict
        else:
            # The child attribute is not wrapped. Wrap with Pref and readd.
            pref_attr = Pref(default=attr)
            self.__new_attr(name, pref_attr)
1150344
public function addAttributes($name, $value)
    {
        if (empty($this->attributes[$name]))
            $this->attributes[$name] = [];

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

        return $this;
    }
570363
public function addAttribute($name, $value = NULL, $namespace = NULL) {
		parent::addAttribute($name, ($value !== NULL ? str_replace('&', '&amp;', $value) : NULL), $namespace);
	}
86738
public function def($attr, $value)
    {
        $this->attributes[$attr] = isset($this->attributes[$attr]) ? $this->attributes[$attr] : (string) $value;
    }
651456
private static function convertValueBasedOnAttributeName($value, $attrName)
    {
        switch ($attrName) {
            case Profile::ATTR_DOCUMENT_DETAILS:
                return new DocumentDetails($value);

            case Profile::ATTR_DOCUMENT_IMAGES:
                if (!($value instanceof MultiValue)) {
                    throw new AttributeException('Document Images could not be decoded');
                }
                return $value
                  ->allowInstance(Image::class)
                  ->immutable();

            default:
                return $value;
        }
    }
1340091
public function attr($name, $value = null){
        if(is_null($value)){
            return $this->getAttributeValue($name);
        }else{
            return $this->setAttribute($name, $value);
        }
    }
493193
static function textArea($name, $value, $attr = array())
    {
        $html = "<textarea ";

        $attr = array_merge(
            array(
                "name" => $name
            ),
            $attr
        );

        $html .= self::getAttributes($attr);
        $html .= ">" . $value . '</textarea>';

        echo $html;
    }
874460
public function setAttribute($attr, $value)
    {
        switch($attr)
        {
        case \PDO::ATTR_AUTOCOMMIT:
            $this->_autocommit = (is_bool($value) && $value) || in_array(strtolower($value), array("on", "true"));
            return;
        case \PDO::ATTR_CASE:
            $this->_case = $value;
            return;
        }
    }
1054702
public function attrJoin($name, $value)
    {
        $idx = $this->attrIndex($name);
        
        if ($idx < 0) {
            $this->attrPush([ $name, $value ]);
        } else {
            $this->attrs[$idx][1] = $this->attrs[$idx][1] . ' ' . $value;
        }
    }
66601
private function gedcomValueStartHandler(array $attrs): void
    {
        $id    = '';
        $match = [];
        if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
            $id = $match[1];
        }

        if (isset($attrs['newline']) && $attrs['newline'] === '1') {
            $useBreak = '1';
        } else {
            $useBreak = '0';
        }

        $tag = $attrs['tag'];
        if (!empty($tag)) {
            if ($tag === '@desc') {
                $value = $this->desc;
                $value = trim($value);
                $this->current_element->addText($value);
            }
            if ($tag === '@id') {
                $this->current_element->addText($id);
            } else {
                $tag = str_replace('@fact', $this->fact, $tag);
                if (empty($attrs['level'])) {
                    $temp  = explode(' ', trim($this->gedrec));
                    $level = $temp[0];
                    if ($level == 0) {
                        $level++;
                    }
                } else {
                    $level = $attrs['level'];
                }
                $tags  = preg_split('/[: ]/', $tag);
                $value = $this->getGedcomValue($tag, $level, $this->gedrec);
                switch (end($tags)) {
                    case 'DATE':
                        $tmp   = new Date($value);
                        $value = $tmp->display();
                        break;
                    case 'PLAC':
                        $tmp   = new Place($value, $this->tree);
                        $value = $tmp->shortName();
                        break;
                }
                if ($useBreak === '1') {
                    // Insert <br> when multiple dates exist.
                    // This works around a TCPDF bug that incorrectly wraps RTL dates on LTR pages
                    $value = str_replace('(', '<br>(', $value);
                    $value = str_replace('<span dir="ltr"><br>', '<br><span dir="ltr">', $value);
                    $value = str_replace('<span dir="rtl"><br>', '<br><span dir="rtl">', $value);
                    if (substr($value, 0, 4) === '<br>') {
                        $value = substr($value, 4);
                    }
                }
                $tmp = explode(':', $tag);
                if (in_array(end($tmp), [
                    'NOTE',
                    'TEXT',
                ])) {
                    $value = Filter::formatText($value, $this->tree); // We'll strip HTML in addText()
                }

                if (!empty($attrs['truncate'])) {
                    $value = strip_tags($value);
                    $value = Str::limit($value, $attrs['truncate'], I18N::translate('…'));
                }
                $this->current_element->addText($value);
            }
        }
    }