diff --git a/core/lib/Thelia/Action/Coupon.php b/core/lib/Thelia/Action/Coupon.php index 9de27bf58..2c8fa9b01 100644 --- a/core/lib/Thelia/Action/Coupon.php +++ b/core/lib/Thelia/Action/Coupon.php @@ -112,8 +112,8 @@ class Coupon extends BaseAction implements EventSubscriberInterface /** * Clear all coupons in session. */ - public function clearAllCoupons() { - + public function clearAllCoupons() + { $this->request->getSession()->setConsumedCoupons(array()); } diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 9d67366cc..571604b69 100644 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -469,7 +469,6 @@ final class TheliaEvents */ const COUPON_CLEAR_ALL = "action.clear_all_coupon"; - /** * Sent just before an attempt to use a Coupon */ diff --git a/core/lib/Thelia/Coupon/CouponManager.php b/core/lib/Thelia/Coupon/CouponManager.php index b4280f4a3..b84fb97c8 100644 --- a/core/lib/Thelia/Coupon/CouponManager.php +++ b/core/lib/Thelia/Coupon/CouponManager.php @@ -280,8 +280,7 @@ class CouponManager { if ($coupon->isUsageUnlimited()) { $ret = true; - } - else { + } else { $ret = false; try { diff --git a/core/lib/Thelia/Coupon/Type/AbstractRemove.php b/core/lib/Thelia/Coupon/Type/AbstractRemove.php index f96a660e9..4cf89c3d6 100644 --- a/core/lib/Thelia/Coupon/Type/AbstractRemove.php +++ b/core/lib/Thelia/Coupon/Type/AbstractRemove.php @@ -12,7 +12,6 @@ namespace Thelia\Coupon\Type; -use Thelia\Core\Translation\Translator; use Thelia\Coupon\FacadeInterface; use Thelia\Model\CartItem; @@ -29,15 +28,15 @@ abstract class AbstractRemove extends CouponAbstract implements AmountAndPercent * * @param Array $effects the Coupon effects params */ - public abstract function setFieldsValue($effects); + abstract public function setFieldsValue($effects); /** * Get the discount for a specific cart item. * - * @param CartItem $cartItem the cart item - * @return float the discount value + * @param CartItem $cartItem the cart item + * @return float the discount value */ - public abstract function getCartItemDiscount($cartItem); + abstract public function getCartItemDiscount($cartItem); /** * @inheritdoc @@ -126,4 +125,4 @@ abstract class AbstractRemove extends CouponAbstract implements AmountAndPercent { return $fieldValue; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Coupon/Type/AbstractRemoveOnAttributeValues.php b/core/lib/Thelia/Coupon/Type/AbstractRemoveOnAttributeValues.php index c0c6f3844..3b54ce0e7 100644 --- a/core/lib/Thelia/Coupon/Type/AbstractRemoveOnAttributeValues.php +++ b/core/lib/Thelia/Coupon/Type/AbstractRemoveOnAttributeValues.php @@ -35,15 +35,15 @@ abstract class AbstractRemoveOnAttributeValues extends CouponAbstract implements * Set the value of specific coupon fields. * @param Array $effects the Coupon effects params */ - public abstract function setFieldsValue($effects); + abstract public function setFieldsValue($effects); /** * Get the discount for a specific cart item. * - * @param CartItem $cartItem the cart item - * @return float the discount value + * @param CartItem $cartItem the cart item + * @return float the discount value */ - public abstract function getCartItemDiscount($cartItem); + abstract public function getCartItemDiscount($cartItem); /** * @inheritdoc @@ -126,7 +126,7 @@ abstract class AbstractRemoveOnAttributeValues extends CouponAbstract implements * using the provided template file, and a list of specific input fields. * * @param string $templateName the path to the template - * @param array $otherFields the list of additional fields fields + * @param array $otherFields the list of additional fields fields * * @return string the rendered template. */ diff --git a/core/lib/Thelia/Coupon/Type/AbstractRemoveOnCategories.php b/core/lib/Thelia/Coupon/Type/AbstractRemoveOnCategories.php index 174c6f7c3..6b14b43c3 100644 --- a/core/lib/Thelia/Coupon/Type/AbstractRemoveOnCategories.php +++ b/core/lib/Thelia/Coupon/Type/AbstractRemoveOnCategories.php @@ -33,15 +33,15 @@ abstract class AbstractRemoveOnCategories extends CouponAbstract implements Amou * * @param Array $effects the Coupon effects params */ - public abstract function setFieldsValue($effects); + abstract public function setFieldsValue($effects); /** * Get the discount for a specific cart item. * - * @param CartItem $cartItem the cart item - * @return float the discount value + * @param CartItem $cartItem the cart item + * @return float the discount value */ - public abstract function getCartItemDiscount($cartItem); + abstract public function getCartItemDiscount($cartItem); /** * @inheritdoc @@ -75,7 +75,6 @@ abstract class AbstractRemoveOnCategories extends CouponAbstract implements Amou $this->category_list = isset($effects[self::CATEGORIES_LIST]) ? $effects[self::CATEGORIES_LIST] : array(); if (! is_array($this->category_list)) $this->category_list = array($this->category_list); - return $this; } /** @@ -147,4 +146,4 @@ abstract class AbstractRemoveOnCategories extends CouponAbstract implements Amou return $fieldValue; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Coupon/Type/AbstractRemoveOnProducts.php b/core/lib/Thelia/Coupon/Type/AbstractRemoveOnProducts.php index c06df1f29..aa407041a 100644 --- a/core/lib/Thelia/Coupon/Type/AbstractRemoveOnProducts.php +++ b/core/lib/Thelia/Coupon/Type/AbstractRemoveOnProducts.php @@ -35,15 +35,15 @@ abstract class AbstractRemoveOnProducts extends CouponAbstract implements Amount * * @param Array $effects the Coupon effects params */ - public abstract function setFieldsValue($effects); + abstract public function setFieldsValue($effects); /** * Get the discount for a specific cart item. * - * @param CartItem $cartItem the cart item - * @return float the discount value + * @param CartItem $cartItem the cart item + * @return float the discount value */ - public abstract function getCartItemDiscount($cartItem); + abstract public function getCartItemDiscount($cartItem); /** * @inheritdoc diff --git a/core/lib/Thelia/Coupon/Type/AmountAndPercentageCouponInterface.php b/core/lib/Thelia/Coupon/Type/AmountAndPercentageCouponInterface.php index 7bc28857f..8fa76e5bb 100644 --- a/core/lib/Thelia/Coupon/Type/AmountAndPercentageCouponInterface.php +++ b/core/lib/Thelia/Coupon/Type/AmountAndPercentageCouponInterface.php @@ -12,10 +12,6 @@ namespace Thelia\Coupon\Type; -use Propel\Runtime\Collection\ObjectCollection; -use Thelia\Condition\ConditionCollection; -use Thelia\Coupon\FacadeInterface; - /** * Represents a Coupon ready to be processed in a Checkout process * @@ -35,18 +31,17 @@ interface AmountAndPercentageCouponInterface /** * Get the discount for a specific cart item. * - * @param CartItem $cartItem the cart item - * @return float the discount value + * @param CartItem $cartItem the cart item + * @return float the discount value */ public function getCartItemDiscount($cartItem); - /** * Renders the template which implements coupon specific user-input, * using the provided template file, and a list of specific input fields. * * @param string $templateName the path to the template - * @param array $otherFields the list of additional fields fields + * @param array $otherFields the list of additional fields fields * * @return string the rendered template. */ @@ -61,4 +56,4 @@ interface AmountAndPercentageCouponInterface * */ public function checkBaseCouponFieldValue($fieldName, $fieldValue); -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Coupon/Type/AmountCouponTrait.php b/core/lib/Thelia/Coupon/Type/AmountCouponTrait.php index e743f7b4d..86c3f65b1 100644 --- a/core/lib/Thelia/Coupon/Type/AmountCouponTrait.php +++ b/core/lib/Thelia/Coupon/Type/AmountCouponTrait.php @@ -32,19 +32,21 @@ Trait AmountCouponTrait { * * @return string the percentage field name */ - protected abstract function getAmountFieldName(); + abstract protected function getAmountFieldName(); /** * @inheritdoc */ - protected function setFieldsValue($effects) { + protected function setFieldsValue($effects) + { $this->amount = $effects[$this->getAmountFieldName()]; } /** * @inheritdoc */ - public function getCartItemDiscount($cartItem) { + public function getCartItemDiscount($cartItem) + { return $cartItem->getQuantity() * $this->amount; } @@ -88,4 +90,4 @@ Trait AmountCouponTrait { return $fieldValue; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Coupon/Type/CouponAbstract.php b/core/lib/Thelia/Coupon/Type/CouponAbstract.php index 71b986fcb..6d57b0d38 100644 --- a/core/lib/Thelia/Coupon/Type/CouponAbstract.php +++ b/core/lib/Thelia/Coupon/Type/CouponAbstract.php @@ -499,4 +499,4 @@ abstract class CouponAbstract implements CouponInterface return $effects; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Coupon/Type/PercentageCouponTrait.php b/core/lib/Thelia/Coupon/Type/PercentageCouponTrait.php index 0b05d126b..caa446cd7 100644 --- a/core/lib/Thelia/Coupon/Type/PercentageCouponTrait.php +++ b/core/lib/Thelia/Coupon/Type/PercentageCouponTrait.php @@ -29,19 +29,21 @@ Trait PercentageCouponTrait { * * @return string the percentage field name */ - protected abstract function getPercentageFieldName(); + abstract protected function getPercentageFieldName(); /** * @inheritdoc */ - protected function setFieldsValue($effects) { + protected function setFieldsValue($effects) + { $this->percentage = $effects[$this->getPercentageFieldName()]; } /** * @inheritdoc */ - public function getCartItemDiscount($cartItem) { + public function getCartItemDiscount($cartItem) + { return $cartItem->getQuantity() * $cartItem->getPrice() * ($this->percentage / 100); } @@ -87,4 +89,4 @@ Trait PercentageCouponTrait { return $fieldValue; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Coupon/Type/RemoveAmountOnAttributeValues.php b/core/lib/Thelia/Coupon/Type/RemoveAmountOnAttributeValues.php index 495c908dc..625de5302 100644 --- a/core/lib/Thelia/Coupon/Type/RemoveAmountOnAttributeValues.php +++ b/core/lib/Thelia/Coupon/Type/RemoveAmountOnAttributeValues.php @@ -12,8 +12,6 @@ namespace Thelia\Coupon\Type; -use Thelia\Core\Translation\Translator; - /** * Allow to remove an amount from the checkout total * @@ -27,7 +25,8 @@ class RemoveAmountOnAttributeValues extends AbstractRemoveOnAttributeValues /** @var string Service Id */ protected $serviceId = 'thelia.coupon.type.remove_amount_on_attribute_av'; - protected function getAmountFieldName() { + protected function getAmountFieldName() + { return self::AMOUNT_FIELD_NAME; } /** diff --git a/core/lib/Thelia/Coupon/Type/RemoveAmountOnCategories.php b/core/lib/Thelia/Coupon/Type/RemoveAmountOnCategories.php index 8843a07d8..54a0bcc17 100644 --- a/core/lib/Thelia/Coupon/Type/RemoveAmountOnCategories.php +++ b/core/lib/Thelia/Coupon/Type/RemoveAmountOnCategories.php @@ -12,11 +12,6 @@ namespace Thelia\Coupon\Type; -use Thelia\Core\Translation\Translator; -use Thelia\Coupon\FacadeInterface; -use Thelia\Model\CartItem; -use Thelia\Model\Category; - /** * Allow to remove an amount from the checkout total * @@ -30,7 +25,8 @@ class RemoveAmountOnCategories extends AbstractRemoveOnCategories /** @var string Service Id */ protected $serviceId = 'thelia.coupon.type.remove_amount_on_categories'; - protected function getAmountFieldName() { + protected function getAmountFieldName() + { return self::AMOUNT_FIELD_NAME; } diff --git a/core/lib/Thelia/Coupon/Type/RemoveAmountOnProducts.php b/core/lib/Thelia/Coupon/Type/RemoveAmountOnProducts.php index 4d6d05906..867f959aa 100644 --- a/core/lib/Thelia/Coupon/Type/RemoveAmountOnProducts.php +++ b/core/lib/Thelia/Coupon/Type/RemoveAmountOnProducts.php @@ -12,9 +12,6 @@ namespace Thelia\Coupon\Type; -use Thelia\Core\Translation\Translator; -use Thelia\Coupon\FacadeInterface; -use Thelia\Model\CartItem; use Thelia\Model\Product; /** @@ -30,7 +27,8 @@ class RemoveAmountOnProducts extends AbstractRemoveOnProducts /** @var string Service Id */ protected $serviceId = 'thelia.coupon.type.remove_amount_on_products'; - protected function getAmountFieldName() { + protected function getAmountFieldName() + { return self::AMOUNT_FIELD_NAME; } @@ -69,4 +67,4 @@ class RemoveAmountOnProducts extends AbstractRemoveOnProducts { return $this->callDrawBackOfficeInputs('coupon/type-fragments/remove-amount-on-products.html'); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Coupon/Type/RemovePercentageOnAttributeValues.php b/core/lib/Thelia/Coupon/Type/RemovePercentageOnAttributeValues.php index 509472e9d..6d2dafebf 100644 --- a/core/lib/Thelia/Coupon/Type/RemovePercentageOnAttributeValues.php +++ b/core/lib/Thelia/Coupon/Type/RemovePercentageOnAttributeValues.php @@ -12,8 +12,6 @@ namespace Thelia\Coupon\Type; -use Thelia\Core\Translation\Translator; - /** * Allow to remove an amount from the checkout total * @@ -32,7 +30,8 @@ class RemovePercentageOnAttributeValues extends AbstractRemoveOnAttributeValues /** * @inheritdoc */ - protected function getPercentageFieldName() { + protected function getPercentageFieldName() + { return self::PERCENTAGE; } diff --git a/core/lib/Thelia/Coupon/Type/RemovePercentageOnCategories.php b/core/lib/Thelia/Coupon/Type/RemovePercentageOnCategories.php index 0106a1ead..e2db763d4 100644 --- a/core/lib/Thelia/Coupon/Type/RemovePercentageOnCategories.php +++ b/core/lib/Thelia/Coupon/Type/RemovePercentageOnCategories.php @@ -12,11 +12,6 @@ namespace Thelia\Coupon\Type; -use Thelia\Core\Translation\Translator; -use Thelia\Coupon\FacadeInterface; -use Thelia\Model\CartItem; -use Thelia\Model\Category; - /** * @author Franck Allimant */ @@ -32,7 +27,8 @@ class RemovePercentageOnCategories extends AbstractRemoveOnCategories /** * @inheritdoc */ - protected function getPercentageFieldName() { + protected function getPercentageFieldName() + { return self::PERCENTAGE; } diff --git a/core/lib/Thelia/Coupon/Type/RemovePercentageOnProducts.php b/core/lib/Thelia/Coupon/Type/RemovePercentageOnProducts.php index df48abf31..cab227442 100644 --- a/core/lib/Thelia/Coupon/Type/RemovePercentageOnProducts.php +++ b/core/lib/Thelia/Coupon/Type/RemovePercentageOnProducts.php @@ -12,9 +12,6 @@ namespace Thelia\Coupon\Type; -use Thelia\Core\Translation\Translator; -use Thelia\Coupon\FacadeInterface; -use Thelia\Model\CartItem; use Thelia\Model\Product; /** @@ -35,7 +32,8 @@ class RemovePercentageOnProducts extends AbstractRemoveOnProducts /** * @inheritdoc */ - protected function getPercentageFieldName() { + protected function getPercentageFieldName() + { return self::PERCENTAGE; } @@ -74,4 +72,4 @@ class RemovePercentageOnProducts extends AbstractRemoveOnProducts { return $this->callDrawBackOfficeInputs('coupon/type-fragments/remove-percentage-on-products.html'); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Coupon/Type/RemoveXAmount.php b/core/lib/Thelia/Coupon/Type/RemoveXAmount.php index 64fcfe033..c1ffb0675 100644 --- a/core/lib/Thelia/Coupon/Type/RemoveXAmount.php +++ b/core/lib/Thelia/Coupon/Type/RemoveXAmount.php @@ -12,8 +12,6 @@ namespace Thelia\Coupon\Type; -use Thelia\Core\Translation\Translator; - /** * Allow to remove an amount from the checkout total * @@ -28,7 +26,8 @@ class RemoveXAmount extends AbstractRemove /** @var string Service Id */ protected $serviceId = 'thelia.coupon.type.remove_x_amount'; - protected function getAmountFieldName() { + protected function getAmountFieldName() + { return self::AMOUNT_FIELD_NAME; } @@ -73,4 +72,4 @@ class RemoveXAmount extends AbstractRemove { return $this->callDrawBackOfficeInputs('coupon/type-fragments/remove-x-amount.html'); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php index 2799cf948..623cb7078 100644 --- a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php +++ b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php @@ -12,9 +12,6 @@ namespace Thelia\Coupon\Type; -use Thelia\Core\Translation\Translator; -use Thelia\Coupon\FacadeInterface; - /** * @package Coupon * @author Guillaume MOREL , Franck Allimant @@ -32,7 +29,8 @@ class RemoveXPercent extends AbstractRemove /** * @inheritdoc */ - protected function getPercentageFieldName() { + protected function getPercentageFieldName() + { return self::INPUT_PERCENTAGE_NAME; } diff --git a/core/lib/Thelia/Model/Coupon.php b/core/lib/Thelia/Model/Coupon.php index 616a7d040..c8b15d43d 100644 --- a/core/lib/Thelia/Model/Coupon.php +++ b/core/lib/Thelia/Model/Coupon.php @@ -268,7 +268,8 @@ class Coupon extends BaseCoupon return CouponModuleQuery::create()->filterByCouponId($this->getId())->find(); } - public function isUsageUnlimited() { + public function isUsageUnlimited() + { return $this->getMaxUsage() == self::UNLIMITED_COUPON_USE; } /**