Get the number of attributes in a list that are present.

@param  array  $attributes
@return int
340499
protected function getPresentCount($attributes)
    {
        $count = 0;

        foreach ($attributes as $key) {
            if (Arr::get($this->data, $key) || Arr::get($this->files, $key)) {
                $count++;
            }
        }

        return $count;
    }
946474
protected function evaluateRequirements(array $attributes)
    {
        foreach ($attributes as $attribute => $value) {
            $value = is_array($value) ? $value : [$value];
            $this->setRequirementsForAttribute($attribute, $value);
        }

        foreach ($this->requirements as $attribute => $parameters) {
            $this->checkForCircularDependency($attribute, $parameters);
        }
    }
868742
public function update(array $attributes)
    {
        if ($this->related->usesTimestamps()) {
            $attributes[$this->relatedUpdatedAt()] = $this->related->freshTimestampString();
        }

        return $this->query->update($attributes);
    }
93377
protected function getAttributes( array $attributes ) : array
   {

      $result = [];

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

      return $result;

   }
1091282
protected function buildAttributes(array $attributes)
    {
        $html = [];

        foreach ($attributes as $key => $value) {
            $html[] = $key.'="'.$value.'"';
        }

        return count($html) ? ' '.implode(' ', $html) : '';
    }
688106
public function setAttributes($attributes)
    {
        if (! is_array($attributes)) {
            $attributes = [$attributes];
        }

        $this->attributes = $attributes;

        return $this;
    }
1092179
public function attributes($attributes)
    {
        if (is_array($this->attributes) and is_array($attributes)) {
            $attributes = array_merge($this->attributes, $attributes);
        }
        $this->attributes = $attributes;

        return $this;
    }
882157
protected function has_changes( array $changes, $attributes = null ) {
		if ( empty( $attributes ) ) {
			return count( $changes ) > 0;
		}

		foreach ( (array) $attributes as $attribute ) {
			if ( array_key_exists( $attribute, $changes ) ) {
				return true;
			}
		}

		return false;
	}
74039
public function addAttributes($attributes, $html = [])
    {
        if (!empty($attributes)) {
            foreach ($attributes as $key => $value) {
                if (!is_null($value)) {
                    $html[] = $key.'="'.Html::entities($value).'"';
                }
            }
        }

        return (count($html) > 0) ? ' '.implode(' ', $html) : '';
    }
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;
    
    }
6947
protected function callClosureAttributes(array $attributes)
    {
        foreach ($attributes as &$attribute) {
            $attribute = $attribute instanceof Closure
                ? $attribute($attributes) : $attribute;
        }

        return $attributes;
    }
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;
    }
48571
protected function filterAttributeValues(array $attributes)
    {
        return array_filter($attributes, function ($value) {
            if (is_array($value) && empty($value)) {
                return false;
            }

            return !($value === '' || $value === null);
        });
    }
935426
public function getAttributesString(array $attributes = array())
    {
        $attributesString = '';

        foreach ($attributes as $name => $values) {
            $value = is_array($values) ? implode(' ', $values) : $values;
            $attributesString .= ' '.$name.'="'.$value.'"';
        }

        return $attributesString;
    }
61218
public function raw(array $attributes = [])
    {
        if ($this->amount === null) {
            return $this->getRawAttributes($attributes);
        }

        if ($this->amount < 1) {
            return [];
        }

        return array_map(function () use ($attributes) {
            return $this->getRawAttributes($attributes);
        }, range(1, $this->amount));
    }
1082781
protected function prepareAttributes(array $attributes)
    {
        foreach ($attributes as $key => $attribute) {
            if (in_array($key, $this->getDates()) && ! is_null($attribute)) {
                $attribute = $this->asDateTime($attribute);
            }
            if ($attribute instanceof DateTime) {
                $attribute = $this->fromDateTime($attribute);
            }
            $attributes[$key] = (string) $attribute;
        }
        return $attributes;
    }
1147987
public static function fromArray(array $attributes) {
		unset($attributes['id']);
		
		$attributesObject = new self();
		
		foreach ($attributes as $key => $value) {
			$attributesObject->add($key, $value);
		}
		
		return $attributesObject;
	}