diff --git a/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php index 1103f74f7..0d0fec0eb 100644 --- a/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php +++ b/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php @@ -166,7 +166,6 @@ abstract class AbstractSeoCrudController extends AbstractCrudController return $response; } - // Error (Default: false) $error_msg = false; diff --git a/core/lib/Thelia/Model/Admin.php b/core/lib/Thelia/Model/Admin.php index 355258336..bba191cd1 100644 --- a/core/lib/Thelia/Model/Admin.php +++ b/core/lib/Thelia/Model/Admin.php @@ -27,6 +27,11 @@ class Admin extends BaseAdmin implements UserInterface { use ModelEventDispatcherTrait; + /** + * Retrieve all permissions for the current admin + * + * @return array|string + */ public function getPermissions() { $profileId = $this->getProfileId(); @@ -105,7 +110,7 @@ class Admin extends BaseAdmin implements UserInterface */ public function eraseCredentials() { - $this->setPassword(null); + parent::setPassword(null); } /** diff --git a/core/lib/Thelia/Model/AreaDeliveryModule.php b/core/lib/Thelia/Model/AreaDeliveryModule.php index 206625a12..39aed03e3 100644 --- a/core/lib/Thelia/Model/AreaDeliveryModule.php +++ b/core/lib/Thelia/Model/AreaDeliveryModule.php @@ -4,7 +4,7 @@ namespace Thelia\Model; use Thelia\Model\Base\AreaDeliveryModule as BaseAreaDeliveryModule; - class AreaDeliveryModule extends BaseAreaDeliveryModule +class AreaDeliveryModule extends BaseAreaDeliveryModule { } diff --git a/core/lib/Thelia/Model/Cart.php b/core/lib/Thelia/Model/Cart.php index 7cf66eeb3..c2cb6486a 100644 --- a/core/lib/Thelia/Model/Cart.php +++ b/core/lib/Thelia/Model/Cart.php @@ -8,6 +8,13 @@ use Thelia\Model\Base\Cart as BaseCart; class Cart extends BaseCart { + /** + * Duplicate the current existing cart. Only the token is changed + * + * @param $token + * @param Customer $customer + * @return Cart + */ public function duplicate($token, Customer $customer = null) { $cartItems = $this->getCartItems(); @@ -62,6 +69,11 @@ class Cart extends BaseCart return $cart; } + /** + * Retrieve the last item added in the cart + * + * @return CartItem + */ public function getLastCartItemAdded() { return CartItemQuery::create() @@ -71,6 +83,18 @@ class Cart extends BaseCart ; } + /** + * + * Retrieve the total taxed amount. + * + * By default, the total include the discount + * + * /!\ The postage amount is not available so it's the total with or without discount an without postage + * + * @param Country $country + * @param bool $discount + * @return float|int + */ public function getTaxedAmount(Country $country, $discount = true) { $total = 0; @@ -86,7 +110,13 @@ class Cart extends BaseCart return $total; } - public function getTotalAmount() + /** + * + * @see getTaxedAmount same as this method but the amount is without taxes + * @param bool $discount + * @return float|int + */ + public function getTotalAmount($discount = true) { $total = 0; @@ -97,11 +127,18 @@ class Cart extends BaseCart $total += $subtotal; } - $total -= $this->getDiscount(); + if ($discount) { + $total -= $this->getDiscount(); + } return $total; } + /** + * Retrieve the total weight for all products in cart + * + * @return float|int + */ public function getWeight() { $weight = 0; diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php index 82f029e61..c5ab471a5 100644 --- a/core/lib/Thelia/Model/Category.php +++ b/core/lib/Thelia/Model/Category.php @@ -36,6 +36,8 @@ class Category extends BaseCategory * * count all products for current category and sub categories * + * /!\ the number of queries is exponential, use it with caution + * * @return int */ public function countAllProducts() diff --git a/core/lib/Thelia/Model/CategoryImageI18n.php b/core/lib/Thelia/Model/CategoryImageI18n.php index 5cfb7577b..3d001c6ad 100644 --- a/core/lib/Thelia/Model/CategoryImageI18n.php +++ b/core/lib/Thelia/Model/CategoryImageI18n.php @@ -4,7 +4,7 @@ namespace Thelia\Model; use Thelia\Model\Base\CategoryImageI18n as BaseCategoryImageI18n; - class CategoryImageI18n extends BaseCategoryImageI18n +class CategoryImageI18n extends BaseCategoryImageI18n { } diff --git a/core/lib/Thelia/Model/ConfigQuery.php b/core/lib/Thelia/Model/ConfigQuery.php index 77653ade1..1daac5745 100644 --- a/core/lib/Thelia/Model/ConfigQuery.php +++ b/core/lib/Thelia/Model/ConfigQuery.php @@ -18,6 +18,16 @@ class ConfigQuery extends BaseConfigQuery { protected static $cache = array(); + /** + * + * Find a config variable and return the value or default value if not founded. + * + * Use this method for better performance, a cache is created for each variable already searched + * + * @param $search + * @param null $default + * @return mixed + */ public static function read($search, $default = null) { if (array_key_exists($search, self::$cache)) { diff --git a/core/lib/Thelia/Model/Country.php b/core/lib/Thelia/Model/Country.php index 1e7748f75..038bd5a61 100644 --- a/core/lib/Thelia/Model/Country.php +++ b/core/lib/Thelia/Model/Country.php @@ -16,6 +16,14 @@ class Country extends BaseCountry { use \Thelia\Model\Tools\ModelEventDispatcherTrait; + /** + * + * Put the current country as the default one. + * + * @throws \RuntimeException + * @throws \Exception + * @throws \Propel\Runtime\Exception\PropelException + */ public function toggleDefault() { if ($this->getId() === null) { diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php index 4d4b3ebfa..940ad931b 100644 --- a/core/lib/Thelia/Model/Customer.php +++ b/core/lib/Thelia/Model/Customer.php @@ -212,7 +212,7 @@ class Customer extends BaseCustomer implements UserInterface */ public function eraseCredentials() { - $this->setPassword(null); + parent::setPassword(null); } /** diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php index f4b1b5abc..1835af62c 100644 --- a/core/lib/Thelia/Model/Order.php +++ b/core/lib/Thelia/Model/Order.php @@ -48,9 +48,12 @@ class Order extends BaseOrder /** * Compute this order amount. * - * @param float $tax (output only) returns the tax amount for this order - * @param bool $includePostage if true, the postage cost is included to the total - * @param bool $includeDiscount if true, the discount will be included to the total + * The order amount amount is only avaible once the order is persisted in database. + * Duting invoice process, use all cart methods instead of order methods (the order doest not exists at this moment) + * + * @param float|int $tax (output only) returns the tax amount for this order + * @param bool $includePostage if true, the postage cost is included to the total + * @param bool $includeDiscount if true, the discount will be included to the total * @return float */ public function getTotalAmount(&$tax = 0, $includePostage = true, $includeDiscount = true)