php-cs fixer passed.
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -469,7 +469,6 @@ final class TheliaEvents
|
||||
*/
|
||||
const COUPON_CLEAR_ALL = "action.clear_all_coupon";
|
||||
|
||||
|
||||
/**
|
||||
* Sent just before an attempt to use a Coupon
|
||||
*/
|
||||
|
||||
@@ -280,8 +280,7 @@ class CouponManager
|
||||
{
|
||||
if ($coupon->isUsageUnlimited()) {
|
||||
$ret = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$ret = false;
|
||||
|
||||
try {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
namespace Thelia\Coupon\Type;
|
||||
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Model\CartItem;
|
||||
|
||||
@@ -29,7 +28,7 @@ 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.
|
||||
@@ -37,7 +36,7 @@ abstract class AbstractRemove extends CouponAbstract implements AmountAndPercent
|
||||
* @param CartItem $cartItem the cart item
|
||||
* @return float the discount value
|
||||
*/
|
||||
public abstract function getCartItemDiscount($cartItem);
|
||||
abstract public function getCartItemDiscount($cartItem);
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
|
||||
@@ -35,7 +35,7 @@ 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.
|
||||
@@ -43,7 +43,7 @@ abstract class AbstractRemoveOnAttributeValues extends CouponAbstract implements
|
||||
* @param CartItem $cartItem the cart item
|
||||
* @return float the discount value
|
||||
*/
|
||||
public abstract function getCartItemDiscount($cartItem);
|
||||
abstract public function getCartItemDiscount($cartItem);
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
|
||||
@@ -33,7 +33,7 @@ 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.
|
||||
@@ -41,7 +41,7 @@ abstract class AbstractRemoveOnCategories extends CouponAbstract implements Amou
|
||||
* @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;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,7 @@ 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.
|
||||
@@ -43,7 +43,7 @@ abstract class AbstractRemoveOnProducts extends CouponAbstract implements Amount
|
||||
* @param CartItem $cartItem the cart item
|
||||
* @return float the discount value
|
||||
*/
|
||||
public abstract function getCartItemDiscount($cartItem);
|
||||
abstract public function getCartItemDiscount($cartItem);
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
|
||||
@@ -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
|
||||
*
|
||||
@@ -40,7 +36,6 @@ interface AmountAndPercentageCouponInterface
|
||||
*/
|
||||
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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <franck@cqfdev.fr>
|
||||
*/
|
||||
@@ -32,7 +27,8 @@ class RemovePercentageOnCategories extends AbstractRemoveOnCategories
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function getPercentageFieldName() {
|
||||
protected function getPercentageFieldName()
|
||||
{
|
||||
return self::PERCENTAGE;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
|
||||
namespace Thelia\Coupon\Type;
|
||||
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
|
||||
/**
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>, Franck Allimant <franck@cqfdev.fr>
|
||||
@@ -32,7 +29,8 @@ class RemoveXPercent extends AbstractRemove
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function getPercentageFieldName() {
|
||||
protected function getPercentageFieldName()
|
||||
{
|
||||
return self::INPUT_PERCENTAGE_NAME;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user