Increments an attribute

The attribute should be an integer field

@param string  $name
@param integer $by
@return integer The value after incrementing (see hincrby)
175942
public function incrementAttribute($name, $by = 1)
    {
        $pipeline = $this->client->pipeline();
        $pipeline->hincrby($this->getHashKey(), $name, $by);
        $pipeline->hset($this->getHashKey(), 'updated', time());
        $result = $pipeline->execute();

        return $this->attributes[$name] = $result[0];
    }
1221640
protected function newField($name=null, $data=null) {
		if($name !== null && isset($this[$name]))
			return;
		$cb = $this->cb;
		$newelement = $cb($data);
		if(!$newelement)
			return;
		$this->add($newelement, $name);
		return $newelement;
	}
476916
public static function incrementingInt(string $name) : Column
    {
        return new Column($name, self::primaryKeyType()->autoIncrement(), true);
    }
946843
public function setN($n)
    {
        if (is_int($n) || (gettype($n) === 'string' && Format::isVariableRef($n))) {
            $this->n = $n;
        } else {
            $msg = "The n attribute must be an integer or a variable reference, '" . gettype($n) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
1355086
public function inc($name, $step = 1)
    {
        $key = $this->getCacheKey($name);
        if (self::$instance->get($key)) {
            return self::$instance->increment($key, $step);
        }

        return self::$instance->set($key, $step);
    }
39557
public function setAttribute($name, $attribute, $value)
    {
        $this->getField($name)->setAttribute($attribute, $value);
    }
430852
public function attr($name, $value = null)
    {
        $attrs = (array) $this->getAttribute('attribs');

        if ($value === null) {
            return isset($attrs[$name]) ? $attrs[$name] : null;
        }

        $attrs[$name] = $value;

        $this->setAttribute('attribs', $attrs);

        return $this;
    }
1054255
public function attr($name, $value = NULL) {
    if (($el = $this->getElement()) === NULL) return NULL;

    if ($el->hasAttribute($name)) {
      if (func_num_args() == 2) {
        $el->setAttribute($name, $value);
      }

      return $el->getAttribute($name);
    }

    return NULL;
  }
1042143
public function incrKey($collection, $key, $by = 1) {

        $current = $this->getKey($collection, $key, 0);
        $newone  = $current + $by;

        $this->setKey($collection, $key, $newone);

        return $newone;
    }
758383
public function increaseTo($name, $value)
    {
        if (false === Numeric::isPositiveInteger($value, false)) {
            throw new InvalidArgumentException('Value of a sequence must be a positive integer');
        }

        $current = $this->read($name);
        if ($value > $current) {
            return $this->update($name, $value);
        }

        return $current;
    }
1178576
public function defineAttribute($name, $field)
    {
        $field = BaseField::createField($field);

        $field->link($this, $name);

        $this->_attributes[$name] = $field;
    }
1292091
public function hasField($name)
    {
        if ($name instanceof Field) {
            return $name;
        }

        $f_object = $this->hasElement($name);
        if (!$f_object || !$f_object instanceof Field) {
            return false;
        }

        return $f_object;
    }
655783
public function withAttribute($name, $value)
    {
        $request             = clone $this;
        $request->attributes = clone $this->attributes;
        $request->attributes->set($name, $value);

        return $request;
    }
941043
function Field($name)
    {
        if (!array_key_exists($name, $this->fields))
            throw new \InvalidArgumentException($name . ' is not a valid field for '. $this->name);
        
        return $this->fields[$name];
    }
346620
public function attr($name, $discriminatorValue = null)
    {
        if (empty($name)) {
            throw new \InvalidArgumentException;
        }

        return new Operand\Attribute($this, $name, $discriminatorValue);
    }
993892
public function setAttribute($name, $data)
    {
        // new fields are detected to *prevent the order of fields*
        // from changing during data processes.

        $attributes = array_keys($this->attributes);
        $cntAttribs = count($attributes);
        if (! in_array($name, $attributes)) {
            // new field detected, store index for correct order
            $this->sortedFields[$cntAttribs-1] = $name;
        }

        if (in_array($name, $this->relations) || method_exists($this, $name)) {
            // subordinate DTO data passed (one-to-one, one-to-many, etc.)
            // build the linked Model using Relationship configuration.
            $this->related[$name] = $this->resolveRelationship($name, $data);
            $this->attributes[$name] = $data; // attributes property contains scalar data
        }
        elseif (empty($this->fillable) || in_array($name, $this->getFields())) {
            // attribute is fillable or any attribute is fillable.
            $this->attributes[$name] = $data;
        }

        // get the dot notation for the said `name` alias (the dot notation is the full path).
        $dotNotation = isset($this->fillable[$name]) ? $this->fillable[$name] : $name;
        $this->dotAttributes[$dotNotation] = $data;

        return $this;
    }
122596
private function getAttributeIndex(string $name): ?int
    {
        $index = $this->ruleMainIndexes[$name] ?? null;

        return $index;
    }