@param array              $attributes
@param AttributeStatement $attributeStatement

@return array
19352
private function resolveAttributesFromAttributeStatement(array $attributes, AttributeStatement $attributeStatement)
    {
        $statementAttributes = $attributeStatement->getAllAttributes();

        return array_reduce($statementAttributes, [$this, 'mapAttributeValues'], $attributes);
    }
1268900
public static function attributes(array $attributes = NULL)
    {
        if (!$attributes) return;

        asort($attributes);
        $h = '';
        foreach ($attributes as $k => $v) {
            $h .= " $k=\"" . self::h($v) . '"';
        }
        return $h;
    }
1106357
private static function resolveAttributes(array $attributes, string $id, bool $withMethod): array
    {
        $default = ['id' => $id, 'aliases' => []];
        if ($withMethod) {
            $default['method'] = '__invoke';
        }
        $attributes = \array_replace($default, $attributes);

        return $attributes;
    }
615814
private function getAttributeValues($attribute, $attributeValues)
    {
        $values = [];
        foreach ($attributeValues as $attributeValue) {
            if ($attribute['id'] == $attributeValue['attributeId']) {
                $values[] = $attributeValue;
            }
        }

        return $values;
    }
258712
public function getAttributes(array $attribute_names = [], array $types = [])
    {
        $attribute_map = [];

        if (empty($attribute_names)) {
            $attribute_map = $this->attribute_map->getItems();
        } else {
            foreach ($attribute_names as $attribute_name) {
                $attribute_map[$attribute_name] = $this->getAttribute($attribute_name);
            }
        }

        if (!empty($types)) {
            $attribute_map = array_filter(
                $attribute_map,
                function ($attribute) use ($types) {
                    return in_array(get_class($attribute), $types);
                }
            );
        }

        return new AttributeMap($attribute_map);
    }
236659
protected function getPhinxTablePrimaryKey(array $attributes, array $table): array
    {
        $primaryKeys = $this->getPrimaryKeys($table);
        $attributes['id'] = false;

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

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

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

        return $attributes;
    }
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;
	}
402767
public function create($attributes)
    {
        $attributes = $this->castRequest($attributes);
        $instance   = $this->model->newInstance($attributes);

        event(implode('-', $this->tag).'.entity.creating', [$this, $instance, $attributes]);

        $created = $instance->save();

        event(implode('-', $this->tag).'.entity.created', [$this, $instance, $attributes]);

        return [
            $created,
            $instance,
        ];
    }
1082304
public static function createAttributes($attributes = [])
    {
        $list = [];

        foreach ($attributes as $key => $value)
        {
            $list[] = sprintf('%s="%s"', $key, is_array($value) ? implode(' ', $value) : $value);
        }

        return implode(' ', $list);
    }
937207
public static function attributes(array $attributes = null) {
        $attributes = (array)$attributes;
        $output = '';
        foreach ($attributes as $name => $value) {
            $output .= self::attribute($name, $value);
        }
        return $output;
    }
623338
protected function extractAttachIdAndAttributes($key, $value, array $attributes)
    {
        return is_array($value)
                    ? [$key, array_merge($value, $attributes)]
                    : [$value, $attributes];
    }
494546
protected function normalizeQueryAttributes(array $attributes)
    {
        $result = [];

        foreach ($attributes as $attribute) {
            $result[] = $this->convertAttribute($attribute);
        }

        return $result;
    }
1246153
public function create(array $attributes = [])
    {
        // Create a new instance
        $instance = $this->createModel();

        // Fill instance with data
        $instance->fill($attributes);

        // Save the instance
        $created = $instance->save();

        // Fire the created event
        $this->getContainer('events')->fire($this->getRepositoryId().'.entity.created', [$this, $instance]);

        // Return instance
        return [
            $created,
            $instance,
        ];
    }
848274
public function withAttributes(array $attributes)
    {
        $clone = clone $this;

        foreach ($attributes as $name => $value) {
            $clone->dom->documentElement->setAttribute($name, $value);
        }

        return $clone;
    }
394908
public static function fromArray(array $attributes) {
        $object = new ArrayObject();
        foreach ($attributes as $key => $val) {
            $object[$key] = $val;
        }
        return $object;
    }
103929
public function getAttributeChangeset(AttributeInterface $attribute)
    {
        if (!array_key_exists($attribute->getCode(), $this->getValuesChangeset())) {
            return [];
        }

        return $this->getValuesChangeset()[$attribute->getCode()];
    }