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

@param array $attr The product link attributes

@return array The initialized product link
439268
protected function initializeProductLink(array $attr)
    {

        // load the product/linked product/link type ID
        $productId = $attr[MemberNames::PRODUCT_ID];
        $linkTypeId = $attr[MemberNames::LINK_TYPE_ID];
        $linkedProductId = $attr[MemberNames::LINKED_PRODUCT_ID];

        // try to load the link with the passed product/linked product/link type ID
        if ($entity = $this->loadProductLink($productId, $linkedProductId, $linkTypeId)) {
            return $this->mergeEntity($entity, $attr);
        }

        // simply return the attributes
        return $attr;
    }
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;
    }
1364796
public function attribute($attr, $value = '')
    {
        if (is_array($attr)) {
            foreach ($attr as $key => $value) {
                $this->attribute($key, $value);
            }
        } else {
            $this->attributes[$attr] = $value;
        }

        return $this;
    }
139395
function resolveAttr(array $attr) {
		$out = '';
		foreach ($attr as $key => $value) {
			// build dynamic tokens
			if (preg_match('/{{(.+?)}}/s', $value))
				$value = $this->template->build($value);
			if (preg_match('/{{(.+?)}}/s', $key))
				$key = $this->template->build($key);
			// inline token
			if (is_numeric($key))
				$out .= ' '.$value;
			// value-less parameter
			elseif($value==NULL)
				$out .= ' '.$key;
			// key-value parameter
			else
				$out .= ' '.$key.'="'.$value.'"';
		}
		return $out;
	}
657908
public function getAttribute($attr)
    {
        return isset($this->attributes[$attr]) ? $this->attributes[$attr] : null;
    }
280572
public function getter($attr)
    {
        if (isset($this->_getters[$attr])) {
            return $this->_getters[$attr];
        } elseif (isset($this->_props[$attr])) {
            return $this->_props[$attr]->getter($attr);
        } elseif (isset($this->_rels[$attr])) {
            return $this->_rels[$attr]->getter($attr);
        }

        throw new Exception("No getter available for $attr");
    }
1128688
public function attributeWas($attr)
    {
        return $this->attributeChanged($attr) ?
                $this->changedAttributes[$attr] :
                $this->getAttribute($attr);
    }
1046804
public function url_first($attr)
    {
        return $this->_nodes ? $this->_document->absolutizeUrl(current($this->_nodes)->getAttribute($attr)) : null;
    }
74553
function getAttribute($attr)
    {
        $attr = strtolower($attr);
        if (isset($this->_attributes[$attr])) {
            return $this->_attributes[$attr];
        }
        return null;
    }
1298984
public function getAttribute($attr) {
        $url = "entities/{$this->_id}/attrs/$attr";

        if ($this->_type) {
            $url .= "?type={$this->_type}";
        }

        return $this->_orion->get($url);
    }
781612
protected function initializeBundleOptionValue(array $attr)
    {

        // load and map the parent option ID
        $parentId = $this->mapSku($this->getValue(ColumnKeys::BUNDLE_PARENT_SKU));

        // load the parent ID, the name and the store ID
        $name = $this->getValue(ColumnKeys::BUNDLE_VALUE_NAME);
        $storeId = $this->getRowStoreId(StoreViewCodes::ADMIN);

        // try to load the bundle option value with the passed name/store/parent ID
        if ($this->loadBundleOptionValue($name, $storeId, $parentId)) {
            return;
        }

        // simply return the attributes
        return $attr;
    }
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");
    }
972335
protected function getAttributesCSS(array $attr)
    {
        $output = [];
        foreach ($attr as $key => $values) {
            if (in_array($key, $this->attributesCss) && $values !== '') {
                $output[] = $key . '="' . $values . '"';
            }
        }
        $implode = implode(' ', $output);

        return $implode
            ? " $implode"
            : '';
    }
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;
    }
1300007
public function attr($attr)
    {
        $data = [];

        foreach ($this->_nodes as $node) {
            $data[] = $node->getAttribute($attr);
        }

        return $data;
    }
1069696
public static function getKeyAlias(array &$attr)
    {
        foreach (TagInfo::$attrKeyAliases as $alias => $key) {
            if (strpos($attr[0], $alias) === 0) {
                return compact('key', 'alias');
            }
        }

        return false;
    }
316720
private function parse_attributes($attr)
    {
        $html = '';

        if (!empty($attr)) {
            $html = '';

            foreach ($attr as $key => $value) {
                $html .= \sprintf('%s="%s" ', $key, \esc_attr($value));
            }
        }

        return \trim($html);
    }