/** * Inserts an item between two nodes * * @param mixed $item The item * @param Bucket $prev The previous bucket * @param Bucket $next The next bucket * * @return void */ protected function insertBetween($item, Bucket $prev, Bucket $next) { $bucket = new ItemBucket($item); $prev->setNext($bucket); $next->setPrev($bucket); $bucket->setPrev($prev); $bucket->setNext($next); $this->current = $bucket; $this->count++; }
/** * Inserts a key-value pair between two nodes * * @param mixed $key The key * @param mixed $value The value * @param Bucket $prev The previous bucket * @param Bucket $next The next bucket * * @return void */ protected function insertBetween($key, $value, Bucket $prev, Bucket $next) { $bucket = new KeyValueBucket($key, $value); $prev->setNext($bucket); $next->setPrev($bucket); $bucket->setPrev($prev); $bucket->setNext($next); $this->current = $bucket; $this->count++; }