From 17daf2821faea37ef432130e0b72de6d29ad477b Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 6 Aug 2013 09:14:13 +0200 Subject: [PATCH] add some phpdoc --- core/lib/Thelia/Action/Cart.php | 35 ++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/core/lib/Thelia/Action/Cart.php b/core/lib/Thelia/Action/Cart.php index 28b5b7531..1883dd733 100755 --- a/core/lib/Thelia/Action/Cart.php +++ b/core/lib/Thelia/Action/Cart.php @@ -36,11 +36,23 @@ use Thelia\Model\CartQuery; use Thelia\Model\Cart as CartModel; use Thelia\Model\Customer; - +/** + * + * Class Cart where all actions are manage like adding, modifying or delete items. + * + * Class Cart + * @package Thelia\Action + */ class Cart implements EventSubscriberInterface { + /** + * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface + */ protected $dispatcher; + /** + * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher + */ public function __construct(EventDispatcherInterface $dispatcher) { $this->dispatcher = $dispatcher; @@ -132,6 +144,13 @@ class Cart implements EventSubscriberInterface ); } + /** + * + * search if cart already exists in session. If not try to create a new one or duplicate an old one. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return \Thelia\Model\Cart + */ public function getCart(Request $request) { @@ -173,8 +192,8 @@ class Cart implements EventSubscriberInterface } /** - * @param Session $session - * @return CartModel + * @param \Thelia\Core\HttpFoundation\Session\Session $session + * @return \Thelia\Model\Cart */ protected function createCart(Session $session) { @@ -194,10 +213,12 @@ class Cart implements EventSubscriberInterface /** - * @param CartModel $cart - * @param Session $session - * @param Customer $customer - * @return CartModel + * try to duplicate existing Cart. Customer is here to determine if this cart belong to him. + * + * @param \Thelia\Model\Cart $cart + * @param \Thelia\Core\HttpFoundation\Session\Session $session + * @param \Thelia\Model\Customer $customer + * @return \Thelia\Model\Cart */ protected function duplicateCart(CartModel $cart, Session $session, Customer $customer = null) {