diff --git a/src/core/Core.php b/src/core/Core.php index 6d8eb0a..8b4e9f8 100644 --- a/src/core/Core.php +++ b/src/core/Core.php @@ -1,6 +1,7 @@ initTwig(); @@ -86,5 +93,24 @@ final class Core implements CoreInterface { $_SESSION['user'] = $this->user = $user; } + + /** + * {@inheritDoc} + * @see \core\CoreInterface::getBasket() + */ + public function getBasket(): Order + { + return $this->basket; + } + + /** + * The basket is depending on the session + * {@inheritDoc} + * @see \core\CoreInterface::setBasket() + */ + public function setBasket(Order $basket): void + { + $_SESSION['basket'] = $this->basket = $basket; + } } diff --git a/src/core/CoreInterface.php b/src/core/CoreInterface.php index 30b14f8..3ce8b82 100644 --- a/src/core/CoreInterface.php +++ b/src/core/CoreInterface.php @@ -2,20 +2,24 @@ namespace core; use entity\user\UserInterface; +use entity\order\Order; /** * * @author kevinfrantz - * + * */ interface CoreInterface { public function getDatabase():\PDO; - - public function getTwig():\Twig_Environment; - - public function getUser():?UserInterface; - - public function setUser(?UserInterface $user = null):void; -} + public function getTwig():\Twig_Environment; + + public function getUser():?UserInterface; + + public function setUser(?UserInterface $user = null):void; + + public function getBasket():Order; + + public function setBasket(Order $basket):void; +}