function addItem(BasketItem $item)
    {
        $basketItems = $this->getParam('basketItems') ?: 0;
        $basketItems++;

        $this->items[$basketItems] = $item;
        $this->addParam('basketItems', $basketItems);

        foreach ($item->toArray() as $param => $value) {
            $this->addParam('basketItem'.$basketItems.ucfirst($param), $value);
        }

        return $this;
    }
function addItem(BasketItem $item)
    {
        $basketItems = $this->getParam('basketItems') ?: 0;
        $basketItems++;

        $this->items[$basketItems] = $item;
        $this->addParam('basketItems', $basketItems);

        foreach ($item->toArray() as $param => $value) {
            $this->addParam('basketItem'.$basketItems.ucfirst($param), $value);
        }

        return $this;
    }
function addItem ( BasketItem $ item ) { $ basketItems = $ this -> getParam ( 'basketItems' ) ? : 0 ; $ basketItems ++ ; $ this -> items [ $ basketItems ] = $ item ; $ this -> addParam ( 'basketItems' , $ basketItems ) ; foreach ( $ item -> toArray ( ) as $ param => $ value ) { $ this -> addParam ( 'basketItem' . $ basketItems . ucfirst ( $ param ) , $ value ) ; } return $ this ; }
Adds an item to the basket

@param BasketItem $item
@return Basket
Adds an item to the basket