public function testGetKey() { $item = new Item('key', $this->storage); $this->assertEquals('key', $item->getKey()); }
/** * Assert Item exists * * @param string itemKey * @return bool hasItem */ public function hasItem($key, $isKey = true) { if (!$isKey) { if ($key instanceof Item) { $key = Item::getKey($key->getId()); } else { $key = Item::getKey($key); } } return isset($this->_items[$key]); }
/** * Remove an Item from this Discount * * @param string * @return Discount */ public function unsetItem($key) { if ($key instanceof Item) { $key = Item::getKey($key->getId()); } if (!count($this->getItems())) { return $this; } $newItems = array_flip($this->getItems()); unset($newItems[$key]); $newItems = array_flip($newItems); $this->_items = $newItems; return $this; }