Check if we can replace original image with swatch image on catalog/category/list page
(copy/paste of parent method).

@param Attribute $attribute Swatch attribute.

@return bool
978187
private function canReplaceImageWithSwatch($attribute)
    {
        $result = true;
        if (!$this->swatchHelperData->isSwatchAttribute($attribute)) {
            $result = false;
        }

        if (!$attribute->getUsedInProductListing()
            || !$attribute->getIsFilterable()
            || !$attribute->getData('update_product_preview_image')
        ) {
            $result = false;
        }

        return $result;
    }
1131687
protected function takeAttributeFromDOM($attribute)
    {
        switch ($attribute->localName) {
        case 'url':
            $this->_url = $attribute->nodeValue;
            break;
        case 'width':
            $this->_width = $attribute->nodeValue;
            break;
        case 'height':
            $this->_height = $attribute->nodeValue;
            break;
        case 'time':
            $this->_time = $attribute->nodeValue;
            break;
        default:
            parent::takeAttributeFromDOM($attribute);
        }
    }
865902
private function isBooleanAttribute($attribute)
    {
        return array_search(trim($attribute), $this->repository->getAttributes()) || Html::isDataAttribute($attribute);
    }
1037523
protected function isDerivedAttribute(Attribute $attribute)
    {
        return preg_match($this->getAgePattern(), $attribute->getName()) ? true : false;
    }
637370
final public function hasAttribute (string $attribute) : bool
	{
		$objectAttributes = $this->attributes();
		return array_key_exists($attribute, $objectAttributes);
	}
190715
protected function takeAttributeFromDOM($attribute)
    {
        switch ($attribute->localName) {
            case 'url':
                $this->_url = $attribute->nodeValue;
                break;
            case 'fileSize':
                $this->_fileSize = $attribute->nodeValue;
                break;
            case 'type':
                $this->_type = $attribute->nodeValue;
                break;
            case 'medium':
                $this->_medium = $attribute->nodeValue;
                break;
            case 'isDefault':
                $this->_isDefault = $attribute->nodeValue;
                break;
            case 'expression':
                $this->_expression = $attribute->nodeValue;
                break;
            case 'bitrate':
                $this->_bitrate = $attribute->nodeValue;
                break;
            case 'framerate':
                $this->_framerate = $attribute->nodeValue;
                break;
            case 'samplingrate':
                $this->_samplingrate = $attribute->nodeValue;
                break;
            case 'channels':
                $this->_channels = $attribute->nodeValue;
                break;
            case 'duration':
                $this->_duration = $attribute->nodeValue;
                break;
            case 'height':
                $this->_height = $attribute->nodeValue;
                break;
            case 'width':
                $this->_width = $attribute->nodeValue;
                break;
            case 'lang':
                $this->_lang = $attribute->nodeValue;
                break;
            default:
                parent::takeAttributeFromDOM($attribute);
        }
    }
312590
public function setAttribute($attribute)
    {
        if (strpos($attribute, '.') !== false) {
            $pieces = explode('.', $attribute, 2);
            $this->setAlias($pieces[0]);
            $attribute = $pieces[1];
        // If an alias was already set then this must be set back to null.
        } else {
            $this->alias = null;
        }
        $this->attribute = $attribute;
    }
387932
public function allowAttribute($attribute)
    {
        if (is_array($attribute))
        {
            foreach ($attribute as $attrib)
                $this->allowed_attributes[$attrib] = true;
        }
        else
            $this->allowed_attributes[$attribute] = true;
        return $this;
    }
727199
public function replaceHtmlAttribute($key, $attribute)
    {
        $attribute                  = $this->prepareHtmlAttributeValue($attribute);
        $this->htmlAttributes[$key] = $attribute;

        return $this;
    }
45013
protected function takeAttributeFromDOM($attribute)
    {
        switch ($attribute->localName) {
            case 'name':
                $name = explode(':', $attribute->nodeValue);
                $this->_name = end($name);
                break;
            case 'value':
                $this->_value = $attribute->nodeValue;
                break;
            default:
                parent::takeAttributeFromDOM($attribute);
        }
    }
1219286
public function validateParentContentElement($attribute)
    {
        if (!$this->cmsContent) {
            return false;
        }

        if (!$this->cmsContent->parentContent) {
            return false;
        }

        if ($this->$attribute) {
            $contentElement = static::findOne($this->$attribute);
            if ($contentElement->cmsContent->id != $this->cmsContent->parentContent->id) {
                $this->addError($attribute,
                    \Yii::t('skeeks/cms', 'The parent must be a content element: «{contentName}».',
                        ['contentName' => $this->cmsContent->parentContent->name]));
            }
        }
    }
989131
protected function shouldAttributeBeFilterable(ModelAttributeDataInterface $attribute)
    {
        // If an attribute is a foreign key, it shouldn't be a filter by default.

        foreach ($this->info->relations as $key => $relation) {

            switch ($relation->type) {

                case RelationType::MORPH_TO:
                case RelationType::BELONGS_TO:
                case RelationType::BELONGS_TO_THROUGH:

                    $keys = $relation->foreign_keys ?: [];

                    if (in_array($attribute->name, $keys)) {
                        return false;
                    }
                    break;
            }
        }

        return true;
    }
529423
public function getAttributeText($attribute) {
		$items = $this->getAttributeItems($attribute, 0, false, true);

		return isset($items[$this->$attribute]) ? $items[$this->$attribute] : null;
	}
1066431
public function attributeIsDirty($attribute)
	{
		return $this->_dirty && isset($this->_dirty[$attribute]) && array_key_exists($attribute, $this->_attributes);
	}
333300
public void replaceAttribute(Attribute original, Attribute newAttribute) {
		for (ListIterator<Attribute> it = attributes.listIterator(); it.hasNext(); )
			if (it.next().equals(original)) {
				it.set(newAttribute);
				break;
			}
	}
852902
public function attr($attribute)
    {
        if (!$this->nodes) {
            throw new \InvalidArgumentException('The current node list is empty.');
        }

        $node = $this->getNode(0);

        return $node->hasAttribute($attribute) ? $node->getAttribute($attribute) : null;
    }
127026
public function hasDirtyPreset($attribute)
    {

        // Require a previous encoding instance
        return ($encoding = $this->encoding($attribute))

            // Make sure the input actually contains a preset.  It won't in cases like
            // the AJAX PUT during listing drag and drop sorting or visibility toggle
            && ($preset_key = $this->encodingPresetInputKey($attribute))
            && request()->exists($preset_key)

            // Check if the preset has changed
            && request($preset_key) != $encoding->preset;
    }