@param null|string $index
@param iterable    $attributes

@return iterable
11643
protected function filterAttributesOnCreate(?string $index, iterable $attributes): iterable
    {
        if ($index !== null) {
            $pkName = $this->getModelSchemas()->getPrimaryKey($this->getModelClass());
            yield $pkName => $index;
        }

        $knownAttrAndTypes = $this->getModelSchemas()->getAttributeTypes($this->getModelClass());
        foreach ($attributes as $attribute => $value) {
            if (array_key_exists($attribute, $knownAttrAndTypes) === true) {
                yield $attribute => $value;
            }
        }
    }
957077
protected function updateInternal($attributes = null)
    {
        if (!$this->beforeSave(false)) {
            return false;
        }
        
        $values = $this->getDirtyAttributes($attributes);
        
        if (empty($values)) {
            $this->afterSave(false, $values);
            
            return 0;
        }
        
        $condition = $this->getOldPrimaryKey(true);
        $lock = $this->optimisticLock();

        if ($lock !== null) {
            if (!isset($values[$lock])) {
                $values[$lock] = $this->$lock + 1;
            }

            $condition[$lock] = $this->$lock;
        }

        // We do not check the return value of update() because it's possible
        // that it doesn't change anything and thus returns 0.
        $rows = static::getBucket()->update($values, $condition);

        if ($lock !== null && !$rows) {
            throw new StaleObjectException('The object being updated is outdated.');
        }
        
        if (isset($values[$lock])) {
            $this->$lock = $values[$lock];
        }
        
        $changedAttributes = [];
        
        foreach ($values as $name => $value) {
            $changedAttributes[$name] = $this->getOldAttribute($name);
            $this->setOldAttribute($name, $value);
        }
        
        $this->afterSave(false, $changedAttributes);
        
        return $rows;
    }
603583
public function lindex($key, $index) {

        $list = $this->get($key, array());

        if($index < 0) {
            $index = count($list) - abs($index);
        }

        return isset($list[$index]) ? $list[$index]:null;
    }
209842
public function getBy($index, $nested = false) {
		$out = array();
		foreach ($this->getArrayCopy() as $model)
			if ($model->exists($index)) {
				$val = $model->get($index, true);
				if (!empty($val))
					if($nested) $out[(string) $val][] = $model;
					else        $out[(string) $val] = $model;
			}
		return $out;
	}
1095289
function addIndex( $attributes ) {
		$name = strtoupper( $attributes['NAME'] );
		$this->indexes[$name] = new dbIndex( $this, $attributes );
		return $this->indexes[$name];
	}
173955
public function getContentByIndex($index)
    {
        $index = intval($index);
        return array_key_exists($index, $this->contents) ? $this->contents[$index] : null;
    }
1048685
public function add($element, $index = null) {
		if ($index === null) {
			$this->collection[$this->size()] = $element;
		} else {
			array_splice($this->collection, $index, 0, $element);
		}
		
		return $this;
	}
1095237
public function getElement($index)
    {
        return (array_key_exists((int) $index, $this->elements) ? $this->elements[$index] : null);
    }
1336184
public String getValue(int index) {
    if (index < 0 || index >= indexSet.size())
      return null;
    return attributes.getValue(indexSet.get(index));
  }
1224876
public function getZone( $index )
    {
        $zone = null;

        if( isset( $this->attributes['zones'][$index] ) )
            $zone = $this->attributes['zones'][$index];

        return $zone;
    }
1082225
public function child($index)
    {
        $child = $this->node->childNodes->item($index);

        return $child === null ? null : new Element($child);
    }
794044
public function setActionIndex(int $index = null) : self
    {
        if ($index) {
            return $this->addAttribute('data-action-index', (string) $index);
        } else {
            return $this->removeAttribute('data-index-action');
        }
    }
642462
public function get($index)
    {
        if (null === $index) {
            throw new Exception\InvalidArgumentException('The specified key name is null');
        }

        if (!$this->has($index)) {
            throw new Exception\OutOfBoundsException(sprintf('Index "%s" is out of bounds', $index));
        }

        return $this->collections[$index];
    }
119542
public function findSources(string $fieldType, array $attributes, string $indexFrom, string $indexTo): array
    {
        foreach ($attributes as $key => $attribute) {
            if ($key === 'source') {
                $attributes[$key] = $this->getSource($fieldType, $attribute, $indexFrom, $indexTo);
            } elseif ($key === 'sources') {
                $attributes[$key] = $this->getSources($fieldType, $attribute, $indexFrom, $indexTo);
            } elseif (is_array($attribute)) {
                $attributes[$key] = $this->findSources($fieldType, $attribute, $indexFrom, $indexTo);
            }
        }

        return $attributes;
    }
627550
public function update(array $attributes = [], $id = null)
    {
        // This allows for update based on the primary key
        if ($id && $this->exists === false) {
            $this->setAttribute($this->getKeyName(), $id);
            $this->exists = true;
        }

        $this->syncOriginal();

        return $this->fill($attributes)->save();
    }
71876
public function getAllFiles($index = null)
	{
		// return the selection
		if ($selection = (func_num_args() and ! is_null($index)) ? $this[$index] : $this->container)
		{
			// make sure selection is an array
			is_array($selection) or $selection = array($selection);
		}
		else
		{
			$selection = array();
		}

		return $selection;
	}
424218
public function setAttributeArray(array $attributes = null)
    {
        if (!is_array($attributes) || empty($attributes)) {
            return;
        }

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