See setHTML() but won't generate exception for non-existing
$tag.

@param string|array|Model $tag
@param string             $value

@return $this
430430
public function trySetHTML($tag, $value = null)
    {
        return $this->_setOrAppend($tag, $value, false, false, false);
    }
1012381
public function add($value)
    {
        /** @var $tag TagInterface */
        $tag = $this->create($value);

        if (null !== $persistedTag = $this->findOneByCode($tag->getCode())) {
            $tag = $persistedTag;
        } else {
            $this->save($tag);
        }

        return $tag;
    }
1122757
public function setReason($value)
    {
        if (!in_array($value, self::reasons(), true)) {
            throw new DomainException(sprintf(self::UNEXPECTED_CATEGORY, implode(', ', self::reasons())));
        }

        return $this->setAttribute('reason', $value);
    }
1270549
public function setAttribute(string $key, $value): AbstractNode
    {
        $this->tag->setAttribute($key, $value);

        //clear any cache
        $this->clear();

        return $this;
    }
361097
public function setMessageAttribute($value)
    {
        $this->attributes['message'] = trim(str_replace("&nbsp;", ' ', strip_tags((isset($value['text'])) ? $value['text'] : (! is_array($value) ? $value : ''))));
    }
991685
public function tryAppend($tag, $value, $encode = true)
    {
        return $this->_setOrAppend($tag, $value, $encode, true, false);
    }
1179307
public function addTag($key, $value)
    {
        $key = trim($key);
        if ($key === '') {
            throw new Exception('Tag Key must not be empty', 1448264366);
        }
        $value = trim($value);
        if ($value === '') {
            throw new Exception('Tag Value must not be empty', 1448264367);
        }
        $tag = Functions::ucfirst($key) . 'DynamicTag_' . $value;
        $this->tags[$tag] = true;
    }
290875
public function setCorePhpthumbNohotlinkValidDomains($value)
    {
        $this->setFieldName('phpthumb_nohotlink_valid_domains');
        $this->loadObject(true);
        $this->setFieldValue($value);

        return $this;
    }
757334
public function addTag(Tag $tag)
    {
        $tag->setBlog($this);
        $this->tags->add($tag);

        return $tag;
    }
1360363
public function setExtension($value)
    {
        if (!in_array($value, self::allowedTypes(), true)) {
            throw new DomainException(sprintf(self::MSG_UNEXPECTED_EXTENSION, implode(', ', self::allowedTypes())));
        }

        return $this->setAttribute('extension', $value);
    }
40297
HtmlTag attr(String name, String value) {
        if (attrs == null) {
            attrs = new HashMap<>();
        }
        attrs.put(name, value);
        return this;
    }
905253
public function setTags($value)
    {
        if (!is_array($value)) {
            $value = [$value];
        }

        $this->values['tags'] = implode(',', $value);

        return $this;
    }
522030
protected function tagBracket(&$value)
    {
        // speed shortcut
        if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != '[') {
            return false;
        }

        $s = $this->seek();
        if ($this->literal('[') && $this->to(']', $c, true) && $this->literal(']', false)) {
            $value = '['.$c.']';
            // whitespace?
            if ($this->whitespace()) {
                $value .= ' ';
            }

            // escape parent selector, (yuck)
            $value = str_replace($this->lessc->parentSelector, '$&$', $value);

            return true;
        }

        $this->seek($s);

        return false;
    }
1104066
public static TaggedValue newTaggedValue(Tag tag, Object value) {
        if (tag == null) {
            throw new IllegalArgumentException("tag must not be null");
        }
        return new TaggedValue(tag, value);
    }
1266742
public function printTag( $tag, $value, array $attributes = [] )
	{
		$attributes = $this->buildAttributesFor( $tag, $attributes );

		printf( '<%s>%s</%s>',
			rtrim( sprintf( '%s %s', $tag, $attributes )),
			$value,
			$tag
		);
	}
1113694
public function setDocumentType($value)
    {
        $allowedTypes = self::allowedTypes();

        if (!in_array($value, $allowedTypes, true)) {
            throw new DomainException(self::MSG_BAD_DOCUMENT_TYPE);
        }

        return $this->setAttribute('documentType', $value);
    }
309941
public function offsetSet($offset, $value)
    {
        switch ($offset) {
            case 'tag':
                $this->setTag($value);
                break;

            case 'indexStart':
                $this->setIndexStartEnd($value);
                break;

            case 'indexEnd':
                if (!isset($this['indexStart'])) {
                    $this->setIndexStartEnd($value, $value);
                } else {
                    $this->setIndexStartEnd($this['indexStart'], $value);
                }
                break;

            case 'indexLength':
                throw new \UnexpectedValueException('indexLength is always calculated.');
            break;

            case 'charStart':
                $this->setCharStartEnd($value);
                break;

            case 'charEnd':
                if (!isset($this['charStart'])) {
                    $this->setCharStartEnd($value, $value);
                } else {
                    $this->setCharStartEnd($this['charStart'], $value);
                }
                break;

            case 'charLength':
                throw new \UnexpectedValueException('CharLength is always calculated.');
            break;

            case 'subSpecs': $this->addSubSpec($value);
            break;

            default:
                throw new \UnexpectedValueException("Offset $offset cannot be set.");
        }
    }