@param array  $array
@param string $attribute

@return mixed
420174
public function localeAttribute(array $array, string $attribute)
    {
        $locale = $this->requestStack->getCurrentRequest()->getLocale();

        return isset($array[$attribute.$locale]) ? $array[$attribute.$locale] : '';
    }
32853
private static function extractAttributes(array $attributes = []): string
    {
        $extracted = [];
        if (\count($attributes) > 0) {
            foreach ($attributes as $name => $value) {
                if ($name != 'id' || ($name == 'id' && $value != '')) {
                    $extracted[] = sprintf(
                        '%s="%s"',
                        \strtolower($name),
                        \htmlspecialchars((string)$value, ENT_COMPAT | ENT_HTML5)
                    );
                }
            }
            return \sprintf(' %s', \implode(' ', $extracted));
        }
        return '';
    }
923220
public function htmlAttributes($array)
    {
        if (!isset($array)) {
            return null;
        }
       
        $str = "";
        foreach ($array as $key => $value) {
            if (!isset($value) || $value === false) {
                continue;
            }
            
            if ($value === true) {
                $value = $key;
            }
            
            $str .= ' ' . $key . '="' . addcslashes($value, '"') . '"';
        }
        
        return trim($str);
    }
1147987
public static function fromArray(array $attributes) {
		unset($attributes['id']);
		
		$attributesObject = new self();
		
		foreach ($attributes as $key => $value) {
			$attributesObject->add($key, $value);
		}
		
		return $attributesObject;
	}
356228
public function getAttribute(string $attribute): array
    {
        // Determine if the attribute is present
        if (! array_key_exists($attribute, $this->attributes)) {
            return [];
        }

        // Return the value of the attribute
        return $this->attributes[$attribute];
    }
981995
protected function doCreateObject(array $array)
    {
        $attribute = new Attribute(isset($array['attributes']) && is_array($array['attributes']) ? $array['attributes'] : $array);
        if (isset($array['attributeValues'])) {
            $mapper = new AttributeValuesMapper();
            foreach ($array['attributeValues'] as $item) {
                $attribute->values[] = $mapper->createObject($item);
            }
        }

        if (isset($array['attributeGroups'])) {
            $mapper           = new AttributeGroupsMapper();
            $attribute->group = $mapper->createObject($array['attributeGroups']);
        }


        return $attribute;
    }
538652
public function attributes(array $attributes)
        {
            $this->attributes = array_replace($this->attributes, $this->markup->attributes($this->tag, $attributes));

            return $this;
        }
334180
public function getAttribute($attributes, $name) {
        foreach($attributes as $a) {
            if ($a->key == $name) {
                return $a->value;
            }
        }
        return null;
    }
1071697
public function fetchValues($tag, $attribute)
    {
        $values = array();

        // loop through each tag in the dom and add it to the array
        foreach ($this->getElementsByTagName($tag) as $element) {
            /* @var $element \DOMElement */
            $values[] = $element->getAttribute($attribute);
        }

        return $values;
    }
221620
protected function attributes(array $attributes): string
	{
		$attr = '';

		foreach($attributes as $attribute => $value)
		{
			if(is_int($attribute))
			{
				$attribute = $value;
			}

			$attr .= ' ' . $attribute . '="' . $value . '"';
		}

		return $attr;
	}
22624
public function multiAttr(String $str, Array $array = []) : String
    {
        $perm  = $this->settings['attr']['perm'] ?? NULL;

        if( is_array($array) )
        {
            $open  = '';
            $close = '';
            $att   = '';
           

            foreach( $array as $k => $v )
            {
                if( ! is_numeric($k) )
                {
                    $element = $k;

                    if( ! is_array($v) )
                    {
                        $att = ' '.$v;
                    }
                    else
                    {
                        $att = $this->attributes($v);
                    }
                }
                else
                {
                    $element = $v;
                }

                $open .= '<'.$element.$att.'>';
                $close = '</'.$element.'>'.$close;
            }
        }
        else
        {
            return $this->_perm($perm, $str);
        }

        return $this->_perm($perm, $open.$str.$close);
    }
660025
protected function replaceAttributes(array $attributes)
    {
        foreach ($this->abbreviations as $abbreviation => $attribute) {
            if (isset($attributes[$abbreviation])) {
                $attributes[$attribute] = $attributes[$abbreviation];
                unset($attributes[$abbreviation]);
            }
        }

        return $attributes;
    }
552469
protected function validateArray( $attribute, $value )
	{
		if ( !$this->hasAttribute( $attribute ) )
		{
			return true;
		}

		return is_null( $value ) || is_array( $value );
	}
324616
public function getTableAttribute($attribute)
    {
        if (! array_key_exists($attribute, $this->tableAttributes)) {
            throw new \Exception("Table attribute '{$attribute}' does not exist.");
        }

        return $this->tableAttributes[$attribute];
    }
1367879
private static function getValueList(array $array): array
    {
        foreach ($array as $i => $attr)
            $array[$i] = (is_array($attr) ? self::getValueList($attr) : self::getValue($attr));

        return $array;
    }
1100746
private function sanitizeAttributes(array $attributes)
    {
        $sanitizeAttributes = [];
        foreach ($attributes as $key => $value) {
            $key = $this->formatAttribute($key);
            if (isset($sanitizeAttributes[$key])) {
                if (!is_array($sanitizeAttributes[$key])) {
                    $sanitizeAttributes[$key] = [$sanitizeAttributes[$key]];
                }

                if (!is_array($value)) {
                    $value = [$value];
                }

                $value = $sanitizeAttributes[$key] + $value;
            }

            $sanitizeAttributes[$key] = $value;
        }

        return $sanitizeAttributes;
    }
17776
public static function fromArray(array $attributes)
    {
        return new self(
            $attributes['id'],
            $attributes['name'],
            $attributes['price'],
            $attributes['quantity'],
            Arr::get($attributes, 'options', [])
        );
    }