Build a single attribute element.

@param string $key
@param string $value

@return string
773627
protected function attributeElement($key, $value)
    {
        // For numeric keys we will assume that the value is a boolean attribute
        // where the presence of the attribute represents a true value and the
        // absence represents a false value.
        // This will convert HTML attributes such as "required" to a correct
        // form instead of using incorrect numerics.
        if (is_numeric($key)) {
            return $value;
        }

        // Treat boolean attributes as HTML properties
        if (is_bool($value) && $key !== 'value') {
            return $value ? $key : '';
        }

        if (is_array($value) && $key === 'class') {
            return 'class="' . implode(' ', $value) . '"';
        }

        if (! is_null($value)) {
            return $key . '="' . e($value, false) . '"';
        }
    }
318760
private function buildProperty($value, $key): string
    {
        if (collect(['from', 'to'])->contains($key)) {
            $value = $this->implode($value);
        }

        return vsprintf("<apps:property name='%s' value='%s'/>", [
            $key,
            htmlentities($this->implode($value)),
        ]);
    }
595950
protected function attributeElement($key, $value)
    {
        // For numeric keys we will assume that the value is a boolean attribute
        // where the presence of the attribute represents a true value and the
        // absence represents a false value.
        // This will convert HTML attributes such as "required" to a correct
        // form instead of using incorrect numeric.
        if (is_numeric($key)) {
            return $value;
        }
        // Treat boolean attributes as HTML properties
        if (is_bool($value) && $key !== 'value') {
            return $value ? $key : '';
        }
        if (! is_null($value)) {
            return $key.'="'.$this->special($value).'"';
        }

        return null;
    }
372366
protected function _buildAttr($key, $val)
    {
        $return = null;
        if (!empty($val) || $val === '0' || $key === 'value') {
            $return = ' ' . $key . '="' . $val . '"';
        }

        return $return;
    }
1346198
public function setAttribute($key, $value)
    {
        if ($key == 'type') {
            switch ($value) {
            case 'image': self::$rules['value'] = 'image';
            break;
            case 'file': self::$rules['value'] = 'file';
            break;
            case 'video-encoder': self::$rules['value'] = 'video';
            break;
        }
        }

        // Continue
        return parent::setAttribute($key, $value);
    }
361225
protected function castAttribute($key, $value)
    {
        if ($value === null) {
            return $value;
        }

        if ($this->getCastType($key) === 'serialize') {
            return $this->fromSerialize($value);
        }

        return parent::castAttribute($key, $value);
    }
68377
public function setAttribute($key, $value)
    {
        if ($this->hasSetMutator($key)) {
            $method = 'set'.Str::studly($key).'Attribute';

            return $this->{$method}($value);
        }

        $this->model->attributes[$key] = $value;
    }
1350253
public function attributes($key = null, $value = null)
    {
        if (is_null($key)) {
            return $this->attributes;
        }

        if (is_array($key)) {
            $this->attributes = array_merge($this->attributes, $key);
        } else {
            $this->attributes[$key] = $value;
        }

        return;
    }
460969
public function setAttribute($key, $value)
    {
        parent::setAttribute($key, $value);
        if ($this->isAesCastable($key, $this->getTable())) {
            $this->attributes[$key] = Cryptor::getInstance()->crypt('encrypt', $value);
        }
        return $this;
    }
280564
public function attribute(string $key)
    {
        if ($key !== 'value') {
            return parent::attribute($key);
        }

        return array_map(
            function (ElementInterface $element) {
                return $element->value();
            },
            $this->elements()
        );
    }
113370
protected function setAttribute($key, $value)
    {
        switch(mb_strtolower($key))
        {
            case 'compression':
            case 'compression lossless':
                $this->lossless = ($value == 'true' || $value == 'Uncompressed');
                break;

            case 'height':
            case 'image height':
            case 'tiff:imageheigth':
            case 'tiff:imagelength':
                $this->height = (int) $value;
                break;

            case 'width':
            case 'image width':
            case 'tiff:imagewidth':
                $this->width = (int) $value;
                break;

            default:
                return false;
        }

        return true;
    }
599236
public function with($key, $value = null)
    {
        if (is_array($key)) {
            $this->attributes = array_merge($this->attributes, $key);
        } else {
            $this->attributes[$key] = $value;
        }

        return $this;
    }
56703
public function setAttribute($key, $value)
	{
		if ($this->castOnSet() && $this->isCastableAttribute($key))
		{
			$value = $this->castAttribute($key, $value);
		}
		return parent::setAttribute($key, $value);
	}
785588
public function setAttribute($key, $value)
    {
        if ($this->isEnumAttribute($key)) {
            $enumClass = $this->getEnumClass($key);
            if (! $value instanceof $enumClass) {
                $value = new $enumClass($value);
            }

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

            return $this;
        }

        parent::setAttribute($key, $value);
    }
617764
public function set_attribute( $key, $value ) {
		$this->attributes[ $key ] = $this->sanitize_attribute( $key, $value );

		return $this;
	}
549451
public function attrs(DOMElement &$element, $value = [])
    {
        if (empty($value)) {
            // Get current attributes
            $attrs = [];
            foreach ($element->attributes as $attr) {
                $attrs[$attr->name] = $attr->value;
            }

            // Return the current attributes
            return $attrs;
        } elseif (is_array($value) && count($value) > 0) {
            // Set the given attributes
            foreach ($value as $key => $val) {
                $this->attr($element, $key, $val);
            }
        }

        return [];
    }
418009
public function put($key, $value = '')
    {
        Arr::set($this->attributes, $key, $value);

        return $this;
    }