public function shiftTo(int $index, int $newIndex) : void
    {
        while ($index > $newIndex) {
            $this->shiftDown($index);
            $index--;
        }
        while ($index < $newIndex) {
            $this->shiftUp($index);
            $index++;
        }
    }
public function shiftTo(int $index, int $newIndex) : void
    {
        while ($index > $newIndex) {
            $this->shiftDown($index);
            $index--;
        }
        while ($index < $newIndex) {
            $this->shiftUp($index);
            $index++;
        }
    }
public function shiftTo ( int $ index , int $ newIndex ) : void { while ( $ index > $ newIndex ) { $ this -> shiftDown ( $ index ) ; $ index -- ; } while ( $ index < $ newIndex ) { $ this -> shiftUp ( $ index ) ; $ index ++ ; } }
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
Shifts an entry to an arbitrary index shifting all the entries between those indexes .