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

@param array $attr The category attributes

@return array The initialized category
768372
protected function initializeCategory(array $attr)
    {

        // initialize the addtional 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
        return array_merge($attr, $additionalAttr);
    }
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);
    }
189356
protected function initializeProductSuperAttributeLabel(array $attr)
    {

        // load product super attribute/store ID
        $storeId = $attr[MemberNames::STORE_ID];
        $productSuperAttributeId = $attr[MemberNames::PRODUCT_SUPER_ATTRIBUTE_ID];

        // query whether or not, the product super attribute label already exists
        if ($entity = $this->loadProductSuperAttributeLabel($productSuperAttributeId, $storeId)) {
            return $this->mergeEntity($entity, $attr);
        }

        // simply return the attributes
        return $attr;
    }
1220135
protected function getAttrAlias(Attr $attr) {
		//check if join is already created
		$stringPath = $attr->getStringPath();
		if (array_key_exists($stringPath, $this->joins))
			return [$this->joins[$stringPath]->getAlias(), $this->joins[$stringPath]->getProfile()];
		
		//
		$path = $attr->getPath();
		$current = $this->profile;
		$parent = null;
		
		for ($i = 0; $i < count($path); $i++) {
			//build join name
			$joinPath = array_slice($path, 0, $i + 1);
			$name = implode('__', $joinPath);
			
			//check association
			if (!$current->hasAssociation($path[$i]))
				throw new \RuntimeException(sprintf("Association '%s' not found in class %s", $path[$i], $current->getReflectionClass()->getName()));
			
			//build join instance
			$association = $current->getAssociation($path[$i]);
			$related = Profiler::getClassProfile($association->getEntityClass());
			
			if (!array_key_exists($name, $this->joins))
				$this->joins[$name] = new Join($association, $related, $this->getJoinAlias(), $parent);
			
			//prepare next iteration
			$current = $related;
			$parent = $name;
		}
		
		return [$this->joins[$parent]->getAlias(), $this->joins[$parent]->getProfile()];
	}
1298984
public function getAttribute($attr) {
        $url = "entities/{$this->_id}/attrs/$attr";

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

        return $this->_orion->get($url);
    }
1061939
public function getAttribute($attr)
    {
        switch($attr)
        {
        case \PDO::ATTR_AUTOCOMMIT:
            return $this->_autocommit;
        case \PDO::ATTR_DRIVER_NAME:
            return 'oci';
        case \PDO::ATTR_CASE:
            return $this->_case;
        }
        return null;
    }
182927
public function createStart($name, $attr = array())
    {
        $p = clone $this->p_start;
        $p->__construct($name, $attr);
        return $p;
    }
1232785
function attribute( $attr )
    {
        switch ( $attr )
        {
            case "original_filename":
                return $this->OriginalFilename;
            case "mime_type":
                return $this->Type;
            case "mime_type_category":
                return $this->MimeCategory;
            case "mime_type_part":
                return $this->MimePart;
            case "filename":
                return $this->Filename;
            case "filesize":
                return $this->Size;
            case "is_temporary":
                return $this->IsTemporary;
            default:
            {
                eZDebug::writeError( "Attribute '$attr' does not exist", __METHOD__ );
                return null;
            } break;
        }
    }
136011
public function avg($attr)
    {
        $builder = $this->_makeBuilderForAggregations(" avg($attr) ");
        return $this->_executeAndReturnFirst($builder, $this->_vals);
    }
566229
public static function attr( $attr = array() ) {
		$buffer = " ";
		foreach( $attr as $key => $value ) {	
			$buffer .= $key.'="'.$value.'" ';
		}
	
		return substr( $buffer, 0, -1 );
	}
240724
public function attr($attribute)
    {
        if (!$this->attributes instanceof EntityAttributeContainer) {
            $this->attributes = $this->createEntityAttributeContainer();
        }

        return $this->attributes->attr($attribute);
    }
187111
function attribute( $attr )
    {
        switch ( $attr )
        {
            case 'currency_list':
            {
                return $this->currencyList();
            } break;

            case 'auto_currency_list':
            {
                return $this->autoCurrencyList();
            } break;

            case 'price_list':
            {
                return $this->priceList();
            } break;

            case 'inc_vat_price_list':
            {
                return $this->incVATPriceList();
            } break;

            case 'ex_vat_price_list':
            {
                return $this->exVATPriceList();
            } break;

            case 'discount_inc_vat_price_list':
            {
                return $this->discountIncVATPriceList();
            } break;

            case 'discount_ex_vat_price_list':
            {
                return $this->discountExVATPriceList();
            } break;

            case 'auto_price_list':
            {
                return $this->autoPriceList();
            } break;

            case 'custom_price_list':
            {
                return $this->customPriceList();
            } break;

            default :
            {
                return eZSimplePrice::attribute( $attr );
            } break;
        }
    }
1122171
public function attr_first($attr)
    {
        return $this->_nodes ? current($this->_nodes)->getAttribute($attr) : null;
    }
1125740
public function attribute( $attr )
    {
        switch( $attr )
        {
            case 'responseHeader':
            {
                return $this->ResultArray['responseHeader'];
            } break;

            case 'hasError':
            {
                return !empty( $this->ResultArray['error'] );
            } break;

            case 'error':
            {
                if ( !empty( $this->ResultArray['error'] ) )
                {
                    return $this->ResultArray['error'];
                }
            } break;

            case 'facet_queries':
            {
                if ( !empty( $this->FacetQueries ) )
                {
                    return $this->FacetQueries;
                }

                // If the facets count is empty, an error has occured.
                if ( empty( $this->ResultArray['facet_counts'] ) )
                {
                    return null;
                }

                $facetArray = array();
                foreach ( $this->ResultArray['facet_counts']['facet_queries'] as $query => $count )
                {
                    list( $field, $fieldValue ) = explode( ':', $query );
                    $fieldInfo = array( 'field' => $field,
                                        'count' => $count,
                                        'queryLimit' => $query,
                                        'fieldValue' => $fieldValue );
                    $facetArray[] = $fieldInfo;
                }

                $this->FacetQueries = $facetArray;
                return $this->FacetQueries;
            } break;

            case 'facet_fields':
            {
                if ( !empty( $this->FacetFields ) )
                {
                    return $this->FacetFields;
                }

                // If the facets count is empty, an error has occured.
                if ( empty( $this->ResultArray['facet_counts'] ) )
                {
                    return null;
                }

                $facetArray = array();
                foreach ( $this->ResultArray['facet_counts']['facet_fields'] as $field => $facetField )
                {
                    switch( $field )
                    {
                        // class facet field
                        case eZSolr::getMetaFieldName( 'contentclass_id' ):
                        {
                            $fieldInfo = array( 'field' => 'class',
                                                'count' => count( $facetField ),
                                                'nameList' => array(),
                                                'queryLimit' => array(),
                                                'fieldList' => array(),
                                                'countList' => array() );
                            foreach ( $facetField as $contentClassID => $count )
                            {
                                if ( $contentClass = eZContentClass::fetch( $contentClassID ) )
                                {
                                    $fieldInfo['nameList'][$contentClassID] = $contentClass->attribute( 'name' );
                                    $fieldInfo['queryLimit'][$contentClassID] = 'contentclass_id:' . $contentClassID;
                                    $fieldInfo['countList'][$contentClassID] = $count;
                                    $fieldInfo['fieldList'][$contentClassID] = 'contentclass_id';
                                }
                                else
                                {
                                    eZDebug::writeWarning( 'Could not fetch eZContentClass: ' . $contentClassID, __METHOD__ );
                                }
                            }
                            $facetArray[] = $fieldInfo;
                        } break;

                        // instalaltion facet field
                        case eZSolr::getMetaFieldName( 'installation_id' ):
                        {
                            $findINI = eZINI::instance( 'ezfind.ini' );
                            $siteNameMapList = $findINI->variable( 'FacetSettings', 'SiteNameList' );
                            $fieldInfo = array( 'field' => 'installation',
                                                'count' => count( $facetField ),
                                                'nameList' => array(),
                                                'queryLimit' => array(),
                                                'fieldList' => array(),
                                                'countList' => array() );
                            foreach ( $facetField as $installationID => $count )
                            {
                                $fieldInfo['nameList'][$installationID] = isset( $siteNameMapList[$installationID] ) ?
                                    $siteNameMapList[$installationID] : $installationID;
                                $fieldInfo['queryLimit'][$installationID] = 'installation_id:' . $installationID;
                                $fieldInfo['countList'][$installationID] = $count;
                                $fieldInfo['fieldList'][$installationID] = 'installation_id';
                            }
                            $facetArray[] = $fieldInfo;
                        } break;

                        // author facet field
                        case eZSolr::getMetaFieldName( 'owner_id' ):
                        {
                            $fieldInfo = array( 'field' => 'author',
                                                'count' => count( $facetField ),
                                                'nameList' => array(),
                                                'queryLimit' => array(),
                                                'fieldList' => array(),
                                                'countList' => array() );
                            foreach ( $facetField as $ownerID => $count )
                            {
                                if ( $owner = eZContentObject::fetch( $ownerID ) )
                                {
                                    $fieldInfo['nameList'][$ownerID] = $owner->attribute( 'name' );
                                    $fieldInfo['queryLimit'][$ownerID] = 'owner_id:' . $ownerID;
                                    $fieldInfo['countList'][$ownerID] = $count;
                                    $fieldInfo['fieldList'][$ownerID] = 'owner_id';
                                }
                                else
                                {
                                    eZDebug::writeWarning( 'Could not fetch owner ( eZContentObject ): ' . $ownerID, __METHOD__ );
                                }
                            }
                            $facetArray[] = $fieldInfo;
                        } break;

                        // translation facet field
                        case eZSolr::getMetaFieldName( 'language_code' ):
                        {
                            $fieldInfo = array( 'field' => 'translation',
                                                'count' => count( $facetField ),
                                                'nameList' => array(),
                                                'queryLimit' => array(),
                                                'fieldList' => array(),
                                                'countList' => array() );
                            foreach ( $facetField as $languageCode => $count )
                            {
                                $fieldInfo['nameList'][$languageCode] = $languageCode;
                                $fieldInfo['queryLimit'][$languageCode] = 'language_code:' . $languageCode;
                                $fieldInfo['fieldList'][$languageCode] = 'language_code';
                                $fieldInfo['countList'][$languageCode] = $count;
                            }
                            $facetArray[] = $fieldInfo;
                        } break;

                        default:
                        {
                            $fieldInfo = array( 'field' => $field,
                                                'count' => count( $facetField ),
                                                'queryLimit' => array(),
                                                'fieldList' => array(),
                                                'nameList' => array(),
                                                'countList' => array() );
                            foreach ( $facetField as $value => $count )
                            {
                                $fieldInfo['nameList'][$value] = $value;
                                $fieldInfo['fieldList'][$value] = $field;
                                $fieldInfo['queryLimit'][$value] = $field . ':' . $value;
                                $fieldInfo['countList'][$value] = $count;
                            }
                            $facetArray[] = $fieldInfo;
                        } break;
                    }
                }

                $this->FacetFields = $facetArray;
                return $this->FacetFields;
            } break;

            case 'engine':
            {
                return eZSolr::engineText();
            } break;


            //may or may not be active, so returns false if not present
            case 'spellcheck':
            {
                if ( isset( $this->ResultArray['spellcheck'] ) && $this->ResultArray['spellcheck']['suggestions'] > 0 )
                {
                    return $this->ResultArray['spellcheck']['suggestions'];
                }
                else
                {
                    return false;
                }
            } break;

            case 'spellcheck_collation':
            {
                if ( isset( $this->ResultArray['spellcheck']['suggestions']['collation'] ) )
                {
                    // work around border case if 'collation' is searched for but does not exist in the spell check index
                    // the collation string is the last element of the suggestions array
                    return end( $this->ResultArray['spellcheck']['suggestions'] );

                }
                else
                {
                    return false;
                }
            } break;

            //only relevant for MoreLikeThis queries
            case 'interestingTerms':
            {
                if ( isset( $this->ResultArray['interestingTerms'] ) )
                {
                    return $this->ResultArray['interestingTerms'];
                }
                else
                {
                    return false;
                }
            } break;
            case 'facet_dates':
            {
                if ( isset( $this->ResultArray['facet_dates'] ) )
                {
                    return $this->ResultArray['facet_dates'];
                }
                else
                {
                    return false;
                }
            } break;

            case 'facet_ranges':
            {
                if ( isset( $this->ResultArray['facet_counts']['facet_ranges'] ) )
                {
                    return $this->ResultArray['facet_counts']['facet_ranges'];
                }
                else
                {
                    return false;
                }
            } break;
            case 'clusters':
            {
                if ( isset( $this->ResultArray['clusters'] ) )
                {
                    return $this->ResultArray['clusters'];
                }
                else
                {
                    return false;
                }
            } break;
            case 'highlighting':
            {
                if ( isset( $this->ResultArray['highlighting'] ) )
                {
                    return $this->ResultArray['highlighting'];
                }
                else
                {
                    return false;
                }
            } break;

            default:
            {
            } break;
        }
        return null;
    }
498456
public function getAttribute($attr, $default = null) {
		
		return ($attr && array_key_exists($attr, $this->attributes)) ? $this->attributes[$attr] : $default;
		
	}
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;
    }
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;
        }
    }