Initialize the category product with the passed attributes and returns an instance.

@param array $attr The category product attributes

@return array The initialized category product
516466
protected function initializeUrlRewrite(array $attr)
    {

        // load the category ID of the passed URL rewrite entity
        $categoryId = $this->getCategoryIdFromMetadata($attr);

        // iterate over the available URL rewrites to find the one that matches the category ID
        foreach ($this->existingUrlRewrites as $urlRewrite) {
            // compare the category IDs AND the request path
            if ($categoryId === $this->getCategoryIdFromMetadata($urlRewrite) &&
                $attr[MemberNames::REQUEST_PATH] === $urlRewrite[MemberNames::REQUEST_PATH]
            ) {
                // if a URL rewrite has been found, do NOT create OR keep an existing redirect
                $this->removeExistingUrlRewrite($urlRewrite);

                // if the found URL rewrite has been created manually
                if ((integer) $urlRewrite[MemberNames::IS_AUTOGENERATED] === 0) {
                    // do NOT update it nor create another redirect
                    return false;
                }

                // if the found URL rewrite has been autogenerated, then update it
                return $this->mergeEntity($urlRewrite, $attr);
            }
        }

        // simple return the attributes
        return $attr;
    }
8676
public function attr_first($css, $attr)
    {
        $nodes = $this->_document->getQuery()->css($css, $this->_node);
        return $nodes ? $nodes->item(0)->getAttribute($attr) : null;
    }
52813
private function _changedAttribute($attr) 
    {
        preg_match('/(\w+)_(change|changed|was)$/', $attr, $matches);
        if (sizeof($matches) < 1) {
            return null;
        }

        $attr = $matches[1];
        $meth = $matches[2];
        $cur  = $this->get($attr);
        $old  = $this->get($attr, false);

        if ($meth == "was") {
            return $old;
        }
        if ($meth == "changed") {
            return $cur!=$old;
        }
        if ($meth == "change") {
            return array($old, $cur);
        }
        return null;
    }
800228
protected function initializeProduct(array $attr)
    {

        // load the product with the passed SKU and merge it with the attributes
        if ($entity = $this->loadProduct($attr[MemberNames::SKU])) {
            return $this->mergeEntity($entity, $attr);
        }

        // otherwise simply return the attributes
        return $attr;
    }
885435
public function attribute( $attr )
    {
        switch ( $attr )
        {
            case 'element':
                return $this->element();
                break;
            case 'tail':
                return $this->elements();
                break;
            case 'base':
                return $this->base();
                break;
            case 'index':
                return $this->index();
                break;
            case 'uri':
                return $this->uriString();
                break;
            case 'original_uri':
                return $this->originalURIString();
                break;
            case 'query_string':
                return eZSys::queryString();
                break;
            default:
            {
                eZDebug::writeError( "Attribute '$attr' does not exist", __METHOD__ );
                return null;
            } break;
        }
    }
703630
public static function make(string $attr)
	{
		$attributes = new static;

		if (! method_exists($attributes, $attr)) {
			throw new \RuntimeException("The attribute {$attr} does not exist in the product object attributes");
		}

		$attributes->attribute = $attributes->$attr();

		return $attributes;
	}
1055350
private function _getBelongsKey($attr)
    {
        $cls = get_called_class();

        if (!array_key_exists($cls, self::$_belongs_to)
            || !array_key_exists($attr, self::$_belongs_to[$cls])
        ) {
            return null;
        }
        $configs       = self::$_belongs_to[$cls][$attr];
        $belongs_cls   = is_array($configs) && array_key_exists("class_name",  $configs) ? $configs["class_name"]  : ucfirst($attr);
        $belongs_key   = is_array($configs) && array_key_exists("foreign_key", $configs) ? $configs["foreign_key"] : strtolower($belongs_cls)."_id";
        return $belongs_key;
    }
250123
protected function initializeUrlRewrite(array $attr)
    {

        // load store ID and request path
        $categoryId = $attr[MemberNames::ENTITY_ID];
        $requestPath = $attr[MemberNames::REQUEST_PATH];

        // iterate over the available URL rewrites to find the one that matches the category ID
        foreach ($this->existingUrlRewrites as $urlRewrite) {
            // compare the category IDs AND the request path
            if ($categoryId === $urlRewrite[MemberNames::ENTITY_ID] &&
                $requestPath === $urlRewrite[MemberNames::REQUEST_PATH]
            ) {
                // if a URL rewrite has been found, do NOT create a redirect
                $this->removeExistingUrlRewrite($urlRewrite);

                // if the found URL rewrite has been created manually
                if ((integer) $urlRewrite[MemberNames::IS_AUTOGENERATED] === 0 && (integer) $urlRewrite[MemberNames::REDIRECT_TYPE] === 0) {
                    // do NOT update it nor create a another redirect
                    return false;
                }

                // if the found URL rewrite has been autogenerated, then update it
                return $this->mergeEntity($urlRewrite, $attr);
            }
        }

        // simple return the attributes
        return $attr;
    }
736387
protected function initializeProductLinkAttributeInt(array $attr)
    {

        // load link/product link attribute ID
        $linkId = $attr[MemberNames::LINK_ID];
        $productLinkAttributeId = $attr[MemberNames::PRODUCT_LINK_ATTRIBUTE_ID];

        // try to load the product link attribute integer value with the passed product link attribute/link ID
        if ($entity = $this->loadProductLinkAttributeInt($productLinkAttributeId, $linkId)) {
            return $this->mergeEntity($entity, $attr);
        }

        // simply return the attributes
        return $attr;
    }
833861
public function attr(Array $attr = [])
    {
        if( isset($this->settings['attr']) && is_array($this->settings['attr']) )
        {
            $settings = $this->settings['attr'];
        }
        else
        {
            $settings = [];
        }

        $this->settings['attr'] = array_merge($settings, $attr);

        return $this;
    }
1128688
public function attributeWas($attr)
    {
        return $this->attributeChanged($attr) ?
                $this->changedAttributes[$attr] :
                $this->getAttribute($attr);
    }
587221
public function getAttr($attr)
    {
        $attributeValue = $this->con->evaluateJavascript(sprintf('%s.getAttribute(%s)', $this->getAccessor(), json_encode($attr)));

        if ($attributeValue === false) {
            // see https://github.com/kriswallsmith/Buzz/pull/138 bug
            return '';
        }

        return $attributeValue;
    }
1105009
public function setter($attr)
    {
        if (isset($this->_setters[$attr])) {
            return $this->_setters[$attr];
        } elseif (isset($this->_props[$attr])) {
            return $this->_props[$attr]->setter($attr);
        } elseif (isset($this->_rels[$attr])) {
            return $this->_rels[$attr]->setter($attr);
        }

        throw new Exception("No setter available for $attr");
    }
1339661
protected function initializeProduct(array $attr)
    {

        // initialize the product attributes
        $attr = parent::initializeProduct($attr);

        // query whether or not, we found a new product
        if ($attr[EntityStatus::MEMBER_NAME] === EntityStatus::STATUS_CREATE) {
            // if yes, initialize the additional Magento 2 EE product values
            $additionalAttr = array(
                MemberNames::ENTITY_ID  => $this->nextIdentifier(),
                MemberNames::CREATED_IN => 1,
                MemberNames::UPDATED_IN => strtotime('+20 years')
            );

            // merge and return the attributes
            $attr = array_merge($attr, $additionalAttr);
        }

        // otherwise simply return the attributes
        return $attr;
    }
774812
public function setAttributes(array $attrs) {

		foreach($attrs as $k => $v) {
			$this->setAttribute($k, $v);
		}

		return $this;

	}
47814
public function removeElementsAttr($attr) {
		foreach ($this->getElements() as $element) {
			if ($element instanceof Tag) {
				$element->removeAttr($attr);
			}
		}
		
		return $this;
	}
1122171
public function attr_first($attr)
    {
        return $this->_nodes ? current($this->_nodes)->getAttribute($attr) : null;
    }