Loops through all the attributes that are to be aggregated into a single attribute for a specific converter.

@param string $attribute
@param array $values
@return array
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];
    }
522116
public static function fromAttributeValues(AttributeValue ...$values): self
    {
        $attribs = array_map(
            function (AttributeValue $value) {
                return $value->toAttribute();
            }, $values);
        return new self(...$attribs);
    }
605321
public function anyCategoryValues($values, $attribute = null)
    {
        /** @var \yii\db\ActiveRecord $model */
        $model = new $this->owner->modelClass();
        $categoryClass = $model->getRelation($model->categoryRelation)->modelClass;

        $this->owner
            ->innerJoinWith($model->categoryRelation, false)
            ->andWhere([$categoryClass::tableName() . '.' . ($attribute ?: $model->categoryValueAttribute) => $model->filterCategoryValues($values)])
            ->addGroupBy(array_map(function ($pk) use ($model) {
                return $model->tableName() . '.' . $pk;
            }, $model->primaryKey()));

        return $this->owner;
    }
274158
public function toCamelCase($attributes)
    {
        $convertedAttributes = [];

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

        return $convertedAttributes;
    }
495107
public function getValuesFor($attributes)
	{
		$ret = array();
		foreach ($attributes as $name) {
			if (array_key_exists($name, $this->_attributes)) {
				$ret[$name] = $this->_attributes[$name];
			}
		}
		return $ret;
	}
1363916
protected function applyDefaultAttrValues(array $attributes = [])
    {
        // Set defaults for each attribute.
        foreach ($this->getMetadata()->getAttributes() as $key => $attrMeta) {
            if (!isset($attrMeta->defaultValue) || isset($attributes[$key])) {
                continue;
            }
            $attributes[$key] = $this->convertAttributeValue($key, $attrMeta->defaultValue);
        }
        return $attributes;
    }
277233
public static function arrayToAttributes(array $attributes)
	{
		//Build a list of single attributes first
		$attributeList = array();

		foreach ( $attributes as $key => $value )
		{
			// If the value is not false add the attribute. This allows attributes to not be shown.
			if ( $value !== false )
			{
				if ( is_string($key) )
				{
					$attributeList[] = htmlspecialchars($key) . '="' . htmlspecialchars($value) . '"';
				}
				else
				{
					$attributeList[] = $value;
				}
			}
		}

		return implode(' ', $attributeList);
	}
1162880
protected function extractDistinctValues($attribute)
    {
        $attributeData = ValidationData::extractDataFromPath(
            ValidationData::getLeadingExplicitAttributePath($attribute), $this->data
        );

        $pattern = str_replace('\*', '[^.]+', preg_quote($attribute, '#'));

        return Arr::where(Arr::dot($attributeData), function ($value, $key) use ($pattern) {
            return (bool) preg_match('#^'.$pattern.'\z#u', $key);
        });
    }
1296824
public function whereIn($attribute, array $values)
    {
        $this->data->must()->terms($attribute, $values);

        return $this;
    }
79897
public function relatedByLanguageValues($values, $attribute = null)
    {
        return $this->anyLanguageValues($values, $attribute)->addOrderBy(new Expression('COUNT(*) DESC'));
    }
937207
public static function attributes(array $attributes = null) {
        $attributes = (array)$attributes;
        $output = '';
        foreach ($attributes as $name => $value) {
            $output .= self::attribute($name, $value);
        }
        return $output;
    }
665733
protected function castAttributes($attributes)
    {
        return $this->using
                    ? $this->newPivot()->fill($attributes)->getAttributes()
                    : $attributes;
    }
494891
private function translateAttributes($attributes)
    {
        $translatedAttributes = [];

        foreach ($attributes as $key => $setting) {
            if (array_key_exists($key, $this->attributesTranslate)) {
                $key = $this->attributesTranslate[ $key ];
            }

            $translatedAttributes[ $key ] = $setting;
        }

        return $translatedAttributes;
    }
322128
protected function getAttributesByFieldNameAndValues(string $fieldName, $values)
    {
        $attributes = [];

        if (empty($values) || empty($this->attributes)) {
            return $attributes;
        }

        foreach ($this->attributes as $attribute) {
            if (in_array($attribute->{$fieldName}, $values)) {
                $attributes[] = $attribute;
            }
        }

        return $attributes;
    }
1323195
public function toArray($attributes = null)
    {
        $result = null;

        $excluded_attributes = self::$_manager->getExcludedAttributes($this);

        if (is_null($attributes)) {
            $result = get_object_vars($this);
        } else {
            $result = array_intersect_key(get_object_vars($this), $attributes);
        }        

        foreach ($excluded_attributes as $excluded_attribute) { 
            unset($result[$excluded_attribute]);
        }

        if (in_array('_last', $result)) {
            unset($result['_last']);
        }
        
        foreach ($result as $key => $value) { 
            if (empty($value)) { 
                unset($result[$key]);
            }
        }

        return $result;
    
    }
1148070
protected function mergeDefaultAttributes(array $attributes)
    {
        if ($this->schema && !empty($this->schema->getDefaultValues())) {
            $attributes = array_merge($this->schema->getDefaultValues(), $attributes);
        }

        return $attributes;
    }
1085778
public function __toArray($attributes = array()){

        if( empty($attributes) ){
            $data = $this->_data;
        }else{

            $data = array();
            foreach( $attributes as $attribute ){
                if( isset($this->_data[$attribute]) ){
                    $data[$attribute] = $this->_data[$attribute];
                } else {
                    $data[$attribute] = NULL;
                }
            }

        }

        foreach( $data as $key => $item ){
            if( $item instanceof AppObject ){
                $item = $item->toArray();
                $data[$key] = $item;
            }
        }

        return $data;
    }