Ensure that any $attributes without provided defaults, return as null if not provided by the user.

@since  1.0.0

@return array Normalised $attributes array.
485049
private function parse_attributes()
    {
        foreach ($this->attributes as $key => $value) {
            if (\is_int($key)) {
                $this->attributes[ $value ] = null;
                unset($this->attributes[ $key ]);
            }
        }

        return $this->attributes;
    }
1356560
public function getAttributes()
    {
        return [
            Attributes\IdAttribute::make(),
            Attributes\TextAttribute::make('name')
                ->setUnique(true)
                ->setRequired(true),
            Attributes\EmailAttribute::make('email')
                ->setRequired(true)
                ->setUnique(true),
            Attributes\PasswordAttribute::make('password')
                ->setRequired(true),
            Attributes\BooleanAttribute::make('enabled'),
            Attributes\TextAttribute::make('token')
                ->setDefault(function ($entity, $attribute) {
                    return $attribute->getManager()->getRepository()->generateToken();
                })
                ->setFillable(false),
            Attributes\EnumAttribute::make('role', ['user', 'admin']),
            Attributes\CreatedAtAttribute::make(),
            Attributes\UpdatedAtAttribute::make(),
            Attributes\DeletedAtAttribute::make(),
        ];
    }
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;
    }
1148070
protected function mergeDefaultAttributes(array $attributes)
    {
        if ($this->schema && !empty($this->schema->getDefaultValues())) {
            $attributes = array_merge($this->schema->getDefaultValues(), $attributes);
        }

        return $attributes;
    }
937497
private function getValue(array $attributes, $name, $default = null)
    {
        if (array_key_exists($name, $attributes) && !empty($attributes[$name])) {
            return $attributes[$name];
        }

        return $default;
    }
44588
protected function _getIdempotencyAttributes($attributes)
    {
        $result = [];
        foreach ($attributes as $key => $value) {
            if ($value['idempotency']) {
                $result[] = $key;
            }
        }
        return implode('&', $result);
    }
1224267
final public function attributes()
    {
        $excluded = array('resultFetcher', 'macros');
        $attributes = get_object_vars($this);

        foreach ($excluded as $key) 
        {
            if (isset($attributes[$key])) { unset($attributes[$key]); }
        }

        return $attributes;
    }
167248
public function attributesToArray()
    {
        $values = array_map(function ($attribute) {
            return $this->getTranslation($attribute, config('app.locale')) ?: null;
        }, $keys = $this->getTranslatableAttributes());

        return array_replace(parent::attributesToArray(), array_combine($keys, $values));
    }
11700
public function attributes(array $names = null)
    {
        if (!$this->node instanceof DOMElement) {
            return null;
        }

        if ($names === null) {
            $result = [];

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

            return $result;
        }

        $result = [];

        foreach ($this->node->attributes as $name => $attribute) {
            if (in_array($name, $names, true)) {
                $result[$name] = $attribute->value;
            }
        }

        return $result;
    }
1104007
protected function getSuccessData($attributes = null)
    {
        $rawData = $this->decodeResponseJson()['data'];

        if (is_null($attributes)) {
            return $rawData;
        } elseif (is_string($attributes)) {
            return array_get($rawData, $attributes);
        }

        $data = [];

        foreach ($attributes as $attribute) {
            $data[] = array_get($rawData, $attribute);
        }

        return $data;
    }
497574
public function getAttributes()
    {
        $id         = $this->getId();
        $attributes = $this->attributes;
        $class      = implode(' ', $this->getClass());
        if ($id) {
            $attributes['id'] = $this->normalizeId($id);
        }
        if ($class) {
            $attributes['class'] = $class;
        }
        return $attributes;
    }
849573
protected static function attributes($attributes)
	{
		$html = array();

		// For numeric keys we will assume that the key and the value are the same
		// as this will convert HTML attributes such as "required" to a correct
		// form like required="required" instead of using incorrect numerics.
		foreach ((array) $attributes as $key => $value)
		{
			$element = null;

			if (is_numeric($key))
			{
				$key = $value;
			}

			if (!is_null($value))
			{
				$element = $key . '="' . htmlentities($value, ENT_COMPAT, 'UTF-8') . '"';
			}

			if (!is_null($element))
			{
				$html[] = $element;
			}
		}

		return count($html) > 0 ? ' ' . implode(' ', $html) : '';
	}
1325635
public function remove($attributes)
    {
        foreach ((array) $attributes as $attribute) {
            unset($this->defaults[$attribute],
                $this->types[$attribute],
                $this->requires[$attribute],
                $this->notNullables[$attribute]);
        }

        return $this;
    }
728803
public function getOldAttributes()
    {
        $attributes = $this->prepareAttributes($this->original);
        $attributes = $this->getRevisionableItems($attributes);
        return $attributes;
    }
1341287
public function getAllAttributes()
    {
        if ($this->node->hasAttributes()) {
            $attributes = [];
            foreach ($this->node->attributes as $attr) {
                $attributes[$attr->name] = $attr->value;
            }

            return $attributes;
        }

        return null;
    }
1307690
protected function prepareAttributes(array $attributes)
    {
        foreach ($attributes as $key => $value) {
            if (is_numeric($key)) {
                unset($attributes[$key]);
                $attributes[$value] = true;
                continue;
            }
        }

        if (isset($attributes['null'])) {
            unset($attributes['null']);
            $attributes['notnull'] = false;
        }

        return $attributes;
    }
1052686
public function getAttributes()
    {
        $attributes = parent::getAttributes();
        $types = $this->types();

        if (sizeof($types)) {
            $attributes['types'] = $types;
        }
        
        if(method_exists($this, 'resolveType'))
        {
            $attributes['resolveType'] = [$this, 'resolveType'];
        }
        
        return $attributes;
    }