rcrowe\Hippy\Queue::offsetSet PHP Method

offsetSet() public method

For example $queue[] = 'string' or $queue[1] = 'string'. NOTE: Currently if adding a new item, even when passing an offset, the value will be appended and not interested at that index. If the index exists, then the old value will be removed and then the new value appended.
public offsetSet ( integer | null $offset, $value ) : void
$offset integer | null Index of the queue to remove/add.
return void
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->add($value);
        } else {
            if ($this->offsetExists($offset)) {
                $this->remove($offset);
            }
            $this->add($value);
        }
    }