public function addItem(PricedItemInterface $item)
    {
        if ($this->hasItem($item)) {
            return $this;
        }

        foreach ($this->items as $existingItem) {
            if ($item->equals($existingItem)) {
                $existingItem->merge($item, false);

                $this->itemsTotal = null;
                $this->total = null;

                return $this;
            }
        }

        $item->setContainer($this);
        $this->items->add($item);

        $this->itemsTotal = null;
        $this->total = null;

        return $this;
    }
public function addItem(PricedItemInterface $item)
    {
        if ($this->hasItem($item)) {
            return $this;
        }

        foreach ($this->items as $existingItem) {
            if ($item->equals($existingItem)) {
                $existingItem->merge($item, false);

                $this->itemsTotal = null;
                $this->total = null;

                return $this;
            }
        }

        $item->setContainer($this);
        $this->items->add($item);

        $this->itemsTotal = null;
        $this->total = null;

        return $this;
    }
public function addItem ( PricedItemInterface $ item ) { if ( $ this -> hasItem ( $ item ) ) { return $ this ; } foreach ( $ this -> items as $ existingItem ) { if ( $ item -> equals ( $ existingItem ) ) { $ existingItem -> merge ( $ item , false ) ; $ this -> itemsTotal = null ; $ this -> total = null ; return $ this ; } } $ item -> setContainer ( $ this ) ; $ this -> items -> add ( $ item ) ; $ this -> itemsTotal = null ; $ this -> total = null ; return $ this ; }
Add an item

@param PricedItemInterface $item

@return $this
Add an item