maxCost = $maxCost; } /** * Get the value of the stored items * * @return float * * @since 1.0.0 */ public function getValue() : float { return $this->value; } /** * Get the cost of the stored items * * @return float * * @since 1.0.0 */ public function getCost() : float { return $this->cost; } /** * Get items * * @return array * * @since 1.0.0 */ public function getItems() : array { return $this->items; } /** * Add item to backpack * * @param Item $item Item * * @return void * * @since 1.0.0 */ public function addItem(Item $item) : void { $this->items[] = $item; $this->value += $item->getValue(); $this->cost += $item->getCost(); } }