File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Cart/ShoppingCartInterface.php
<?php declare(strict_types=1);
namespace App\Cart;
use App\Discounts\DiscountableInterface;
use App\Products\AbstractProductable;
/**
* Represents a shopping cart
*
* Class ShoppingCartService
*
* @package App\Cart
*/
interface ShoppingCartInterface extends DiscountableInterface
{
/**
* Add a productable in the cart
*
* @param AbstractProductable $productable
* @param int $quantity
*
* @return ShoppingCartItem
*/
public function addProductable(AbstractProductable $productable, int $quantity = 1): ?ShoppingCartItem;
/**
* Set the amount of items for a product
*
* @param int $itemId
* @param int $quantity
*
* @return $this
*/
public function setItemQuantity(int $itemId, int $quantity = 1): ShoppingCartInterface;
/**
* Deletes the ShoppingCartItem that has a product with the specified id
*
* @param int $itemId
*
* @return ShoppingCartInterface
*/
public function deleteItem(int $itemId): ShoppingCartInterface;
/**
* Clears the shopping cart of all items
*
* @return ShoppingCartInterface
*/
public function clear(): ShoppingCartInterface;
/**
* Returns the amount of items in the cart.
*
* @return int
*/
public function getItemsCount(): int;
/**
* Get all shopping cart items
*
* @return array
*/
public function getItems(): array;
}