src/Cart.php
public function update($itemId, $key, $value)
    {
        $item = $this->find($itemId);

        if (!$item) {
            throw new \InvalidArgumentException(sprintf('Item [%s] does not exist in cart.', $itemId));
        }

        $item->$key = $value;

        return $item->id;
    }
public function update($itemId, $key, $value)
    {
        $item = $this->find($itemId);

        if (!$item) {
            throw new \InvalidArgumentException(sprintf('Item [%s] does not exist in cart.', $itemId));
        }

        $item->$key = $value;

        return $item->id;
    }
public function update ( $ itemId , $ key , $ value ) { $ item = $ this -> find ( $ itemId ) ; if ( ! $ item ) { throw new \ InvalidArgumentException ( sprintf ( 'Item [%s] does not exist in cart.' , $ itemId ) ) ; } $ item -> $ key = $ value ; return $ item -> id ; }
Update an item in the cart.

@param string $itemId
@param string $key
@param mixed  $value

@return string

@throws \InvalidArgumentException
Update an item in the cart .