/** * Delete a value from this list and remove gaps in keys * * NOTE: parent::offsetUnset() maps to $this->delete() so this method covers both usages * * @param string $key * @return void */ public function delete($key) { parent::delete($key); // Reindex the array to eliminate any gaps $this->items = array_values($this->items); }
/** * @testdox delete() removes an item by name */ public function testDelete() { $collection = new NormalizedCollection(); $collection->add('foobar'); $collection->delete('foobar'); $this->assertFalse($collection->exists('foobar')); }