Get aggregations config.

@param \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection $attributes The attributes

@return array
772345
private function getAggregationsConfig($attributes)
    {
        $aggregations = [];
        foreach ($attributes as $attribute) {
            $bucketConfig                        = $this->getBucketConfig($attribute);
            $aggregations[$bucketConfig['name']] = $bucketConfig;
        }

        return $aggregations;
    }
321301
protected function convertAggregateValues($attribute, array $values)
    {
        $this->aggregated[] = $attribute;
        $converterName = $this->schema->getConverter($attribute);
        $toAggregate = array_keys($this->schema->getConverterMap(), $converterName);

        /**
         * Only aggregate values going back the same LDAP attribute, as it's possible for the a converter to have many
         * different attributes assigned to it.
         *
         * @todo Probably a better way to do this...
         */
        $aggregateToLdap = $this->schema->getAttributeToLdap($attribute);
        foreach ($toAggregate as $i => $aggregate) {
            if ($this->schema->getAttributeToLdap($aggregate) !== $aggregateToLdap) {
                unset($toAggregate[$i]);
            }
        }
        $values = $this->iterateAggregates($toAggregate, $values, $converterName);

        return is_array($values) ? $values : [$values];
    }
274158
public function toCamelCase($attributes)
    {
        $convertedAttributes = [];

        foreach ($attributes as $key => $value) {
            $key = $this->getTrueKey($key);
            $convertedAttributes[$key] = $value;
        }

        return $convertedAttributes;
    }
93377
protected function getAttributes( array $attributes ) : array
   {

      $result = [];

      foreach ( $attributes as $attribute )
      {
         if ( ! ( $attribute instanceof Descriptor ) )
         {
            continue;
         }
         $result[ $attribute->getName() ] = $attribute;
      }

      return $result;

   }
48022
protected function selectAttributes($attributes = ['*'])
    {
        $attributes = $attributes ?: ['*'];

        if ($attributes == ['*'] && $this->attributes != ['*']) {
            $attributes = $this->attributes;
        }

        return $attributes;
    }
818015
public function getAttributes(): array
    {
        if ($this->isLink === false) {
            return $this->attributes;
        } else {
            return array_merge(
                ['link' => $this->link],
                $this->attributes
            );
        }
    }
1146964
private function mapAttributeValues(array $attributes, Attribute $attribute)
    {
        $key = $attribute->getName();
        $value = $attribute->getAllAttributeValues();

        if (!array_key_exists($key, $attributes) && 1 === count($value)) {
            $value = array_shift($value);
        }

        if (array_key_exists($key, $attributes)) {
            $currentValue = (is_array($attributes[$key]) ? $attributes[$key] : [$attributes[$key]]);

            $value = array_merge($currentValue, $value);
        }

        $attributes[$key] = $value;

        return $attributes;
    }
779874
protected function prepareAttributes(array $attributes)
    {
        return array_map(function ($attribute) {
            return ($attribute instanceof DateTime)
                ? $this->fromDateTime($attribute)
                : (string) $attribute;
        }, $attributes);
    }
937
public function getAttribute($attribute)
    {
        return !empty($this->attributes[$attribute]) ? $this->attributes[$attribute] : null;
    }
1098167
public function getAttributeArray( $keys ) {

		$data = [];

		foreach( $keys as $key ) {

			$data[ $key ] = $this->$key;
		}

		return $data;
	}
993876
public function getAPIAttributes($params=array(), $relations = false)
    {
        $attributes = array();
        foreach ($this->attributes as $k=>$v)
        {
        	if (in_array($k, $params))
        		continue;

            $attributes[$k] = $v;
        }

        if ($relations != false)
        {
	        foreach ($relations as $relation=>$params)
	        {
	        	if (is_integer($relation))
	        	{
	        		$relation = $params;
	        		$params = array();
	        	}

	        	if (is_array($this->$relation))
	        	{
	        		$attributes[$relation] = array();
	        		foreach ($this->$relation as $k)
	        			$attributes[$relation][] = $k->getAPIAttributes($params);
	        	}
	        	else
	        	{
	        		if (isset($this->$relation))
	        			$attributes[$relation] = $this->$relation->getAPIAttributes($params);
	        		else
	        			$attributes[$relation] = array();
	        	}
	        }
        }

        return $attributes;
    }
665733
protected function castAttributes($attributes)
    {
        return $this->using
                    ? $this->newPivot()->fill($attributes)->getAttributes()
                    : $attributes;
    }
1359944
public function iniCasts(Collection $attributes)
    {
        $this->casts = $attributes->mapWithKeys(function ($attribute) {
            return [$attribute->getName() => $attribute];
        })->map(function ($attribute) {
            if ($attribute instanceof Attributes\ObjectAttribute) {
                return 'object';
            }

            if ($attribute instanceof Attributes\ArrayAttribute) {
                return 'array';
            }

            if ($attribute instanceof Attributes\BooleanAttribute) {
                return 'boolean';
            }

            if ($attribute instanceof Attributes\DateTimeAttribute) {
                return 'datetime';
            }

            if ($attribute instanceof Attributes\NumberAttribute) {
                return 'float';
            }

            if ($attribute instanceof Attributes\TextAttribute) {
                return 'string';
            }

            return null;
        })->filter(function ($item) {
            return $item !== null;
        })->toArray();
    }
273042
public static function extractAttributes(array $attributes): array
    {
        $result = ['resource_class' => $attributes['_api_resource_class'] ?? null];
        if ($subresourceContext = $attributes['_api_subresource_context'] ?? null) {
            $result['subresource_context'] = $subresourceContext;
        }

        if (null === $result['resource_class']) {
            return [];
        }

        $hasRequestAttributeKey = false;
        foreach (OperationType::TYPES as $operationType) {
            $attribute = "_api_{$operationType}_operation_name";
            if (isset($attributes[$attribute])) {
                $result["{$operationType}_operation_name"] = $attributes[$attribute];
                $hasRequestAttributeKey = true;
                break;
            }
        }

        if (false === $hasRequestAttributeKey) {
            return [];
        }

        $result += [
            'receive' => (bool) ($attributes['_api_receive'] ?? true),
            'respond' => (bool) ($attributes['_api_respond'] ?? true),
            'persist' => (bool) ($attributes['_api_persist'] ?? true),
        ];

        return $result;
    }
791293
public function getAttributes()
    {
        $attributes = array();

        foreach ($this->getProperty() as $name => $property) {
            if ($property->isAttribute()) {
                $attributes[$name] = $property;
            }
        }

        return $attributes;
    }
849641
public function getAttributes()
    {
        $interfaces = $this->interfaces();

        $attributes = array_merge(
            $this->attributes(),
            [
                'fields' => function () {
                    return $this->getFields();
                },
            ]
        );

        if (!empty($interfaces)) {
            $attributes['interfaces'] = $interfaces;
        }

        return $attributes;
    }
867163
public function setAttributes($attributes)
    {
        if (isset($attributes['class'])) {
            $class = $attributes['class'];
            $this->setClass([$class]);
            unset($attributes['class']);
        }
        $this->attributes = $attributes;
        return $this;
    }