Shifts an entry to an arbitrary index, shifting all the entries between those indexes.

@param int $index    The index of the entry.
@param int $newIndex The index to shift the entry to.

@return void
772776
public function shiftTo(int $index, int $newIndex) : void
    {
        while ($index > $newIndex) {
            $this->shiftDown($index);
            $index--;
        }
        while ($index < $newIndex) {
            $this->shiftUp($index);
            $index++;
        }
    }
256113
public function offsetUnset($index)
    {
        $this->value = \mb_substr($this->value, 0, $index) . \mb_substr($this->value, $index + 1);
        --$this->length;
    }
73194
public function offsetSet($index, $row) 
    {
        if (is_null($index)) {
            $this->rows[] = $row;
        } else {
            $this->rows[$index] = $row;
        }
    }
707155
public function removeTokenAt($index) {
        // Remove token from behind
        if ($index < 0) {
            $index = count($this->tokens) + $index;
        }
        array_splice($this->tokens, $index, 1);
    }
838784
public function set($index, $newValue) {
        if (!$this->offsetSet($index, $newValue)) {
            $this->append($newValue);
        }

        return $this;
    }
962573
public function removeAt($index)
    {
        if (isset($this[$index])) {
            foreach ($this->_associated_objects as $parent_property => $object) {
                /**
                 * @var Model
                 */
                $object->setDirty($parent_property);
            }
            unset($this[$index]);
        }
    }
1074562
public function removeIndex($index)
    {
        if ($this->hasIndex($index)) {
            unset($this->_items[$index]);
            $this->_iterator = null;
            return true;
        }
        return false;
    }
397333
public function offsetSet($index, $item) : void
    {
        if ($item instanceof Fieldset) {
            foreach ($item as $subitem) {
                $this->setValue($subitem);
            }
        } else {
            $this->setValue($item);
        }
        parent::offsetSet($index, $item);
    }
392878
public function removeGroup(int $index): void
    {
        unset($this->groups[$index]);
        $this->groups = array_values($this->groups);
    }
253857
public function renameName($nameIndex, $newName)
    {
        $nameIndex = (int)$nameIndex;
        foreach ($this->positions as $position) {
            $source = $position->source;
            if ($source->nameIndex === $nameIndex) {
                $source->name = $newName;
            }
        }
    }
222727
public function addIndex($index, $after=null) {

        // Detect duplicates first
        if ($this->getIndex($index->getName())) {
            throw new coding_exception('Duplicate index '.$index->getName().' specified in table '.$this->getName());
        }

        // Make sure there are no keys with the index column specs because they would collide.
        $newfields = $index->getFields();
        $allkeys = $this->getKeys();
        foreach ($allkeys as $key) {
            $fields = $key->getFields();
            if ($fields === $newfields) {
                throw new coding_exception('Key '.$key->getName().' collides with index'.$index->getName().' specified in table '.$this->getName());
            }
        }

        // Calculate the previous and next indexes
        $previndex = null;
        $nextindex = null;

        if (!$after) {
            $allindexes = $this->getIndexes();
            if (!empty($allindexes)) {
                end($allindexes);
                $previndex = $allindexes[key($allindexes)];
            }
        } else {
            $previndex = $this->getIndex($after);
        }
        if ($previndex && $previndex->getNext()) {
            $nextindex = $this->getIndex($previndex->getNext());
        }

        // Set current index previous and next attributes
        if ($previndex) {
            $index->setPrevious($previndex->getName());
            $previndex->setNext($index->getName());
        }
        if ($nextindex) {
            $index->setNext($nextindex->getName());
            $nextindex->setPrevious($index->getName());
        }

        // Some more attributes
        $index->setLoaded(true);
        $index->setChanged(true);
        // Add the new index
        $this->indexes[] = $index;
        // Reorder the indexes
        $this->orderIndexes($this->indexes);
        // Recalculate the hash
        $this->calculateHash(true);
        // We have one new index, so the table has changed
        $this->setChanged(true);
    }
831511
public function createIndex(Index $index, $table)
    {
        $this->_execSql($this->_platform->getCreateIndexSQL($index, $table));
    }
571074
public function dropAndCreateIndex(Index $index, $table)
    {
        $this->tryMethod('dropIndex', $index->getQuotedName($this->_platform), $table);
        $this->createIndex($index, $table);
    }
374176
public function setIndex($index)
    {
        if ($index instanceof Index) {
            $index = $index->getName();
        }

        return $this->setParam('_index', $index);
    }
474927
public function forgetIndex(AbstractIndex $index)
    {
        foreach ($this->indexes as $name => $indexSchema) {
            if ($indexSchema == $index) {
                unset($this->indexes[$name]);
                break;
            }
        }
    }
674450
public static function remove($index)
    {
        if (isset(self::$views[$index])) {
            self::$views[$index] = null;
        }
    }
929245
public function shiftUp(int $index) : void
    {
        if ($index + 1 === $this->count()) {
            return;
        }

        $this->swap($index, $index + 1);
    }