php-cs pass
This commit is contained in:
@@ -32,7 +32,7 @@ class CartEvent extends ActionEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $append
|
* @param bool $append
|
||||||
* @return CartEvent
|
* @return CartEvent
|
||||||
*/
|
*/
|
||||||
public function setAppend($append)
|
public function setAppend($append)
|
||||||
@@ -51,7 +51,7 @@ class CartEvent extends ActionEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param CartItem $cartItem
|
* @param CartItem $cartItem
|
||||||
* @return CartEvent
|
* @return CartEvent
|
||||||
*/
|
*/
|
||||||
public function setCartItem($cartItem)
|
public function setCartItem($cartItem)
|
||||||
@@ -70,7 +70,7 @@ class CartEvent extends ActionEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $newness
|
* @param bool $newness
|
||||||
* @return CartEvent
|
* @return CartEvent
|
||||||
*/
|
*/
|
||||||
public function setNewness($newness)
|
public function setNewness($newness)
|
||||||
@@ -89,7 +89,7 @@ class CartEvent extends ActionEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $product the product ID
|
* @param int $product the product ID
|
||||||
* @return CartEvent
|
* @return CartEvent
|
||||||
*/
|
*/
|
||||||
public function setProduct($product)
|
public function setProduct($product)
|
||||||
@@ -108,7 +108,7 @@ class CartEvent extends ActionEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $productSaleElementsId
|
* @param int $productSaleElementsId
|
||||||
* @return CartEvent
|
* @return CartEvent
|
||||||
*/
|
*/
|
||||||
public function setProductSaleElementsId($productSaleElementsId)
|
public function setProductSaleElementsId($productSaleElementsId)
|
||||||
@@ -127,7 +127,7 @@ class CartEvent extends ActionEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $quantity
|
* @param int $quantity
|
||||||
* @return CartEvent
|
* @return CartEvent
|
||||||
*/
|
*/
|
||||||
public function setQuantity($quantity)
|
public function setQuantity($quantity)
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ class BaseFacade implements FacadeInterface
|
|||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Country the delivery country
|
* @return Country the delivery country
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -274,8 +274,8 @@ class CouponManager
|
|||||||
/**
|
/**
|
||||||
* Clear all data kept by coupons
|
* Clear all data kept by coupons
|
||||||
*/
|
*/
|
||||||
public function clear() {
|
public function clear()
|
||||||
|
{
|
||||||
$coupons = $this->facade->getCurrentCoupons();
|
$coupons = $this->facade->getCurrentCoupons();
|
||||||
|
|
||||||
/** @var CouponInterface $coupon */
|
/** @var CouponInterface $coupon */
|
||||||
|
|||||||
@@ -503,7 +503,8 @@ abstract class CouponAbstract implements CouponInterface
|
|||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function clear() {
|
public function clear()
|
||||||
|
{
|
||||||
// Does nothing. Override this function as needed.
|
// Does nothing. Override this function as needed.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,11 @@ namespace Thelia\Coupon\Type;
|
|||||||
use Thelia\Core\Event\Cart\CartEvent;
|
use Thelia\Core\Event\Cart\CartEvent;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
use Thelia\Coupon\FacadeInterface;
|
|
||||||
use Thelia\Model\CartItem;
|
use Thelia\Model\CartItem;
|
||||||
use Thelia\Model\CartItemQuery;
|
use Thelia\Model\CartItemQuery;
|
||||||
use Thelia\Model\Product;
|
use Thelia\Model\Product;
|
||||||
use Thelia\Model\ProductQuery;
|
use Thelia\Model\ProductQuery;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow to remove an amount from the checkout total
|
* Allow to remove an amount from the checkout total
|
||||||
*
|
*
|
||||||
@@ -66,7 +64,8 @@ class FreeProduct extends AbstractRemoveOnProducts
|
|||||||
/**
|
/**
|
||||||
* @return string The session variable where the cart item IDs for the free products are stored
|
* @return string The session variable where the cart item IDs for the free products are stored
|
||||||
*/
|
*/
|
||||||
protected function getSessionVarName() {
|
protected function getSessionVarName()
|
||||||
|
{
|
||||||
return "coupon.free_product.cart_items." . $this->getCode();
|
return "coupon.free_product.cart_items." . $this->getCode();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -76,8 +75,8 @@ class FreeProduct extends AbstractRemoveOnProducts
|
|||||||
*
|
*
|
||||||
* @return bool|int|CartItem the cart item which contains the free product, or false if the product is no longer in the cart, or ADD_TO_CART_IN_PROCESS if the adding process is not finished
|
* @return bool|int|CartItem the cart item which contains the free product, or false if the product is no longer in the cart, or ADD_TO_CART_IN_PROCESS if the adding process is not finished
|
||||||
*/
|
*/
|
||||||
protected function getRelatedCartItem($product) {
|
protected function getRelatedCartItem($product)
|
||||||
|
{
|
||||||
$cartItemIdList = $this->facade->getRequest()->getSession()->get(
|
$cartItemIdList = $this->facade->getRequest()->getSession()->get(
|
||||||
$this->getSessionVarName(),
|
$this->getSessionVarName(),
|
||||||
array()
|
array()
|
||||||
@@ -89,12 +88,10 @@ class FreeProduct extends AbstractRemoveOnProducts
|
|||||||
|
|
||||||
if ($cartItemId == self::ADD_TO_CART_IN_PROCESS) {
|
if ($cartItemId == self::ADD_TO_CART_IN_PROCESS) {
|
||||||
return self::ADD_TO_CART_IN_PROCESS;
|
return self::ADD_TO_CART_IN_PROCESS;
|
||||||
}
|
} elseif (null !== $cartItem = CartItemQuery::create()->findPk($cartItemId)) {
|
||||||
else if (null !== $cartItem = CartItemQuery::create()->findPk($cartItemId)) {
|
|
||||||
return $cartItem;
|
return $cartItem;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Maybe the product we're offering is already in the cart ? Search it.
|
// Maybe the product we're offering is already in the cart ? Search it.
|
||||||
$cartItems = $this->facade->getCart()->getCartItems();
|
$cartItems = $this->facade->getCart()->getCartItems();
|
||||||
|
|
||||||
@@ -117,11 +114,11 @@ class FreeProduct extends AbstractRemoveOnProducts
|
|||||||
/**
|
/**
|
||||||
* Set the cart item id which contains the free product related to a given product
|
* Set the cart item id which contains the free product related to a given product
|
||||||
*
|
*
|
||||||
* @param Product $product the product in the cart which triggered the discount
|
* @param Product $product the product in the cart which triggered the discount
|
||||||
* @param bool|int $cartItemId the cart item ID which contains the free product, or just true if the free product is not yet added.
|
* @param bool|int $cartItemId the cart item ID which contains the free product, or just true if the free product is not yet added.
|
||||||
*/
|
*/
|
||||||
protected function setRelatedCartItem($product, $cartItemId) {
|
protected function setRelatedCartItem($product, $cartItemId)
|
||||||
|
{
|
||||||
$cartItemIdList = $this->facade->getRequest()->getSession()->get(
|
$cartItemIdList = $this->facade->getRequest()->getSession()->get(
|
||||||
$this->getSessionVarName(),
|
$this->getSessionVarName(),
|
||||||
array()
|
array()
|
||||||
@@ -142,7 +139,8 @@ class FreeProduct extends AbstractRemoveOnProducts
|
|||||||
*
|
*
|
||||||
* @return array an array where the free product ID is the key, and the related cart item id the value.
|
* @return array an array where the free product ID is the key, and the related cart item id the value.
|
||||||
*/
|
*/
|
||||||
protected function getFreeProductsCartItemIds() {
|
protected function getFreeProductsCartItemIds()
|
||||||
|
{
|
||||||
return $this->facade->getRequest()->getSession()->get(
|
return $this->facade->getRequest()->getSession()->get(
|
||||||
$this->getSessionVarName(),
|
$this->getSessionVarName(),
|
||||||
array()
|
array()
|
||||||
@@ -152,7 +150,8 @@ class FreeProduct extends AbstractRemoveOnProducts
|
|||||||
/**
|
/**
|
||||||
* Clear the session variable.
|
* Clear the session variable.
|
||||||
*/
|
*/
|
||||||
protected function clearFreeProductsCartItemIds() {
|
protected function clearFreeProductsCartItemIds()
|
||||||
|
{
|
||||||
return $this->facade->getRequest()->getSession()->remove($this->getSessionVarName());
|
return $this->facade->getRequest()->getSession()->remove($this->getSessionVarName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +161,8 @@ class FreeProduct extends AbstractRemoveOnProducts
|
|||||||
*
|
*
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function isMatching() {
|
public function isMatching()
|
||||||
|
{
|
||||||
$match = parent::isMatching();
|
$match = parent::isMatching();
|
||||||
|
|
||||||
if (! $match) {
|
if (! $match) {
|
||||||
@@ -279,8 +279,7 @@ class FreeProduct extends AbstractRemoveOnProducts
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} elseif ($fieldName === self::OFFERED_CATEGORY_ID) {
|
||||||
else if ($fieldName === self::OFFERED_CATEGORY_ID) {
|
|
||||||
if (empty($fieldValue)) {
|
if (empty($fieldValue)) {
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
Translator::getInstance()->trans(
|
Translator::getInstance()->trans(
|
||||||
@@ -293,7 +292,6 @@ class FreeProduct extends AbstractRemoveOnProducts
|
|||||||
return $fieldValue;
|
return $fieldValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get I18n name
|
* Get I18n name
|
||||||
*
|
*
|
||||||
@@ -344,4 +342,4 @@ class FreeProduct extends AbstractRemoveOnProducts
|
|||||||
// Clear the session variable when the coupon is cleared.
|
// Clear the session variable when the coupon is cleared.
|
||||||
$this->clearFreeProductsCartItemIds();
|
$this->clearFreeProductsCartItemIds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user