mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
slightly modified cart interface.
This commit is contained in:
parent
862443b73f
commit
e203e63840
2 changed files with 12 additions and 83 deletions
|
|
@ -167,6 +167,11 @@ abstract class Cart implements CartInterface
|
|||
$this->items = array();
|
||||
}
|
||||
|
||||
public function isExpired()
|
||||
{
|
||||
return $this->getExpiresAt() < new \DateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -18,97 +18,21 @@ namespace Sylius\Bundle\CartBundle\Model;
|
|||
*/
|
||||
interface CartInterface
|
||||
{
|
||||
/**
|
||||
* Returns id.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function getId();
|
||||
|
||||
/**
|
||||
* Returns total item count.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function getTotalItems();
|
||||
|
||||
/**
|
||||
* Sets total item count.
|
||||
*
|
||||
* @param integer $totalItems
|
||||
*/
|
||||
function setTotalItems($totalItems);
|
||||
|
||||
function incrementTotalItems($amount = null);
|
||||
function isLocked();
|
||||
function setLocked($locked);
|
||||
|
||||
/**
|
||||
* Checks whether the cart is empty.
|
||||
*/
|
||||
function isEmpty();
|
||||
|
||||
function setItems($items);
|
||||
|
||||
/**
|
||||
* Returns all items from cart.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getItems();
|
||||
|
||||
/**
|
||||
* Returns number of items in cart.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function countItems();
|
||||
|
||||
/**
|
||||
* Adds item to cart.
|
||||
*
|
||||
* @param ItemInterface $item
|
||||
*/
|
||||
function addItem(ItemInterface $item);
|
||||
|
||||
/**
|
||||
* Remove item from cart.
|
||||
*
|
||||
* @param ItemInterface $item
|
||||
*/
|
||||
function removeItem(ItemInterface $item);
|
||||
|
||||
/**
|
||||
* Has item in cart?
|
||||
*
|
||||
* @param Item
|
||||
*/
|
||||
function hasItem(ItemInterface $item);
|
||||
|
||||
/**
|
||||
* Removes all items from cart.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function clearItems();
|
||||
|
||||
/**
|
||||
* Returns expiration time.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
function setItems($items);
|
||||
function getItems();
|
||||
function addItem(ItemInterface $item);
|
||||
function removeItem(ItemInterface $item);
|
||||
function hasItem(ItemInterface $item);
|
||||
function getExpiresAt();
|
||||
|
||||
/**
|
||||
* Sets expiration time.
|
||||
*
|
||||
* @param \DateTime $expiresAt
|
||||
*/
|
||||
function isExpired();
|
||||
function setExpiresAt(\DateTime $expiresAt);
|
||||
|
||||
/**
|
||||
* Increments expiration time.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function incrementExpiresAt();
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue