From ef142ca077f78521a083a3368b899b2ea0c6d0bf Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Sat, 17 May 2014 10:24:22 +0200 Subject: [PATCH] Applied php-cs-fixer --- core/lib/Thelia/Action/Coupon.php | 9 ++---- .../Implementation/AbstractMatchCountries.php | 9 +++--- .../Implementation/CartContainsCategories.php | 6 ++-- .../Implementation/CartContainsProducts.php | 5 ++-- .../Implementation/ConditionAbstract.php | 6 ++-- .../Implementation/ForSomeCustomers.php | 2 +- .../Implementation/MatchBillingCountries.php | 7 +++-- .../Implementation/MatchDeliveryCountries.php | 7 +++-- .../Implementation/MatchForEveryone.php | 4 +-- .../Implementation/MatchForXArticles.php | 1 - .../Condition/Implementation/StartDate.php | 15 ++++------ .../Controller/Admin/CouponController.php | 4 +-- .../Core/Event/Coupon/CouponConsumeEvent.php | 7 +++-- .../Coupon/CouponCreateOrUpdateEvent.php | 7 +++-- core/lib/Thelia/Core/Template/Loop/Coupon.php | 4 +-- .../Thelia/Core/Template/Loop/OrderCoupon.php | 4 +-- .../Smarty/Assets/SmartyAssetsManager.php | 5 ++-- core/lib/Thelia/Coupon/BaseFacade.php | 3 +- core/lib/Thelia/Coupon/CouponManager.php | 13 ++++---- .../lib/Thelia/Coupon/Type/CouponAbstract.php | 8 +++-- .../Thelia/Coupon/Type/CouponInterface.php | 30 +++++++++---------- core/lib/Thelia/Form/CouponCreationForm.php | 7 ++--- .../Thelia/Tests/Coupon/CouponManagerTest.php | 1 - 23 files changed, 76 insertions(+), 88 deletions(-) diff --git a/core/lib/Thelia/Action/Coupon.php b/core/lib/Thelia/Action/Coupon.php index cf80b0da7..b8e2a7553 100644 --- a/core/lib/Thelia/Action/Coupon.php +++ b/core/lib/Thelia/Action/Coupon.php @@ -28,8 +28,6 @@ use Thelia\Coupon\Type\CouponInterface; use Thelia\Model\Coupon as CouponModel; use Thelia\Model\CouponCountry; use Thelia\Model\CouponCountryQuery; -use Thelia\Model\CouponCustomerCount; -use Thelia\Model\CouponCustomerCountQuery; use Thelia\Model\CouponModule; use Thelia\Model\CouponModuleQuery; use Thelia\Model\CouponQuery; @@ -309,7 +307,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface $couponCountries = CouponCountryQuery::create()->filterByCouponId($couponModel->getId())->find(); /** @var CouponCountry $couponCountry */ - foreach($couponCountries as $couponCountry) { + foreach ($couponCountries as $couponCountry) { $occ = new OrderCouponCountry(); $occ @@ -322,7 +320,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface $couponModules = CouponModuleQuery::create()->filterByCouponId($couponModel->getId())->find(); /** @var CouponModule $couponModule */ - foreach($couponModules as $couponModule) { + foreach ($couponModules as $couponModule) { $ocm = new OrderCouponModule(); $ocm @@ -334,8 +332,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface } $con->commit(); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { $con->rollBack(); throw($ex); diff --git a/core/lib/Thelia/Condition/Implementation/AbstractMatchCountries.php b/core/lib/Thelia/Condition/Implementation/AbstractMatchCountries.php index 0e35b16d1..b2d075db2 100644 --- a/core/lib/Thelia/Condition/Implementation/AbstractMatchCountries.php +++ b/core/lib/Thelia/Condition/Implementation/AbstractMatchCountries.php @@ -44,9 +44,9 @@ abstract class AbstractMatchCountries extends ConditionAbstract parent::__construct($facade); } - protected abstract function getSummaryLabel($cntryStrList, $i18nOperator); + abstract protected function getSummaryLabel($cntryStrList, $i18nOperator); - protected abstract function getFormLabel(); + abstract protected function getFormLabel(); /** * @inheritdoc @@ -87,6 +87,7 @@ abstract class AbstractMatchCountries extends ConditionAbstract // The delivery address should match one of the selected countries. /* TODO !!!! */ + return $this->conditionValidator->variableOpComparison( $this->facade->getNbArticlesInCart(), $this->operators[self::COUNTRIES_LIST], @@ -110,7 +111,7 @@ abstract class AbstractMatchCountries extends ConditionAbstract if (null !== $cntryList = CountryQuery::create()->findPks($cntryIds)) { /** @var Category $cntry */ - foreach($cntryList as $cntry) { + foreach ($cntryList as $cntry) { $cntryStrList .= $cntry->getTitle() . ', '; } @@ -147,4 +148,4 @@ abstract class AbstractMatchCountries extends ConditionAbstract ] ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Condition/Implementation/CartContainsCategories.php b/core/lib/Thelia/Condition/Implementation/CartContainsCategories.php index 010b4f9ba..6a1208456 100644 --- a/core/lib/Thelia/Condition/Implementation/CartContainsCategories.php +++ b/core/lib/Thelia/Condition/Implementation/CartContainsCategories.php @@ -93,12 +93,12 @@ class CartContainsCategories extends ConditionAbstract $cartItems = $this->facade->getCart()->getCartItems(); /** @var CartItem $cartItem */ - foreach($cartItems as $cartItem) { + foreach ($cartItems as $cartItem) { $categories = $cartItem->getProduct()->getCategories(); /** @var Category $category */ - foreach($categories as $category) { + foreach ($categories as $category) { $catecoryInCart = $this->conditionValidator->variableOpComparison( $category->getId(), $this->operators[self::CATEGORIES_LIST], @@ -156,7 +156,7 @@ class CartContainsCategories extends ConditionAbstract if (null !== $catList = CategoryQuery::create()->findPks($catIds)) { /** @var Category $cat */ - foreach($catList as $cat) { + foreach ($catList as $cat) { $catStrList .= $cat->getTitle() . ', '; } diff --git a/core/lib/Thelia/Condition/Implementation/CartContainsProducts.php b/core/lib/Thelia/Condition/Implementation/CartContainsProducts.php index 6fd495b72..39ce9963e 100644 --- a/core/lib/Thelia/Condition/Implementation/CartContainsProducts.php +++ b/core/lib/Thelia/Condition/Implementation/CartContainsProducts.php @@ -93,13 +93,12 @@ class CartContainsProducts extends ConditionAbstract $cartItems = $this->facade->getCart()->getCartItems(); /** @var CartItem $cartItem */ - foreach($cartItems as $cartItem) { + foreach ($cartItems as $cartItem) { if ($this->conditionValidator->variableOpComparison( $cartItem->getProduct()->getId(), $this->operators[self::PRODUCTS_LIST], $this->values[self::PRODUCTS_LIST])) { - return true; } } @@ -149,7 +148,7 @@ class CartContainsProducts extends ConditionAbstract if (null !== $prodList = ProductQuery::create()->findPks($prodIds)) { /** @var Product $prod */ - foreach($prodList as $prod) { + foreach ($prodList as $prod) { $prodStrList .= $prod->getTitle() . ', '; } diff --git a/core/lib/Thelia/Condition/Implementation/ConditionAbstract.php b/core/lib/Thelia/Condition/Implementation/ConditionAbstract.php index d5064d081..4289cad3c 100644 --- a/core/lib/Thelia/Condition/Implementation/ConditionAbstract.php +++ b/core/lib/Thelia/Condition/Implementation/ConditionAbstract.php @@ -66,15 +66,15 @@ abstract class ConditionAbstract implements ConditionInterface } /** - * @param array $operatorList the list of comparison operator values, as entered in the condition parameter form + * @param array $operatorList the list of comparison operator values, as entered in the condition parameter form * @param string $parameterName the name of the parameter to check * * @return $this * * @throws \Thelia\Exception\InvalidConditionOperatorException if the operator value is not in the allowed value */ - protected function checkComparisonOperatorValue($operatorList, $parameterName) { - + protected function checkComparisonOperatorValue($operatorList, $parameterName) + { $isOperator1Legit = $this->isOperatorLegit( $operatorList[$parameterName], $this->availableOperators[$parameterName] diff --git a/core/lib/Thelia/Condition/Implementation/ForSomeCustomers.php b/core/lib/Thelia/Condition/Implementation/ForSomeCustomers.php index 7d77ed103..b7b66a3d6 100644 --- a/core/lib/Thelia/Condition/Implementation/ForSomeCustomers.php +++ b/core/lib/Thelia/Condition/Implementation/ForSomeCustomers.php @@ -139,7 +139,7 @@ class ForSomeCustomers extends ConditionAbstract if (null !== $custList = CustomerQuery::create()->findPks($custIds)) { /** @var Customer $cust */ - foreach($custList as $cust) { + foreach ($custList as $cust) { $custStrList .= $cust->getLastname() . ' ' . $cust->getFirstname() . ' ('.$cust->getRef().'), '; } diff --git a/core/lib/Thelia/Condition/Implementation/MatchBillingCountries.php b/core/lib/Thelia/Condition/Implementation/MatchBillingCountries.php index ffd067815..6c5afa3e7 100644 --- a/core/lib/Thelia/Condition/Implementation/MatchBillingCountries.php +++ b/core/lib/Thelia/Condition/Implementation/MatchBillingCountries.php @@ -69,8 +69,8 @@ class MatchBillingCountries extends AbstractMatchCountries return $toolTip; } - protected function getSummaryLabel($cntryStrList, $i18nOperator) { - + protected function getSummaryLabel($cntryStrList, $i18nOperator) + { return $this->translator->trans( 'Only if order billing country is %op% %countries_list%', [ '%countries_list%' => $cntryStrList, @@ -79,7 +79,8 @@ class MatchBillingCountries extends AbstractMatchCountries ); } - protected function getFormLabel() { + protected function getFormLabel() + { return $this->translator->trans( 'Billing coutry is', [], 'condition' ); diff --git a/core/lib/Thelia/Condition/Implementation/MatchDeliveryCountries.php b/core/lib/Thelia/Condition/Implementation/MatchDeliveryCountries.php index 519cc3ade..c10b531e7 100644 --- a/core/lib/Thelia/Condition/Implementation/MatchDeliveryCountries.php +++ b/core/lib/Thelia/Condition/Implementation/MatchDeliveryCountries.php @@ -69,8 +69,8 @@ class MatchDeliveryCountries extends AbstractMatchCountries return $toolTip; } - protected function getSummaryLabel($cntryStrList, $i18nOperator) { - + protected function getSummaryLabel($cntryStrList, $i18nOperator) + { return $this->translator->trans( 'Only if order shipping country is %op% %countries_list%', [ '%countries_list%' => $cntryStrList, @@ -79,7 +79,8 @@ class MatchDeliveryCountries extends AbstractMatchCountries ); } - protected function getFormLabel() { + protected function getFormLabel() + { return $this->translator->trans( 'Delivery coutry is', [], 'condition' ); diff --git a/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php b/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php index f85ea4350..f9ee59894 100644 --- a/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php +++ b/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php @@ -26,8 +26,8 @@ class MatchForEveryone extends ConditionAbstract /** * @inheritdoc */ - public function __construct(FacadeInterface $facade) { - + public function __construct(FacadeInterface $facade) + { // Define the allowed comparison operators $this->availableOperators = []; diff --git a/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php b/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php index 2f56abdb4..ed55c901d 100644 --- a/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php +++ b/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php @@ -14,7 +14,6 @@ namespace Thelia\Condition\Implementation; use Thelia\Condition\Operators; use Thelia\Coupon\FacadeInterface; -use Thelia\Exception\InvalidConditionOperatorException; use Thelia\Exception\InvalidConditionValueException; /** diff --git a/core/lib/Thelia/Condition/Implementation/StartDate.php b/core/lib/Thelia/Condition/Implementation/StartDate.php index afcbb5814..251ba395b 100644 --- a/core/lib/Thelia/Condition/Implementation/StartDate.php +++ b/core/lib/Thelia/Condition/Implementation/StartDate.php @@ -14,11 +14,7 @@ namespace Thelia\Condition\Implementation; use Thelia\Condition\Operators; use Thelia\Coupon\FacadeInterface; -use Thelia\Exception\InvalidConditionOperatorException; use Thelia\Exception\InvalidConditionValueException; -use Thelia\Model\Category; -use Thelia\Model\CategoryImageQuery; -use Thelia\Model\CategoryQuery; use Thelia\Tools\DateTimeFormat; /** @@ -76,8 +72,7 @@ class StartDate extends ConditionAbstract } $timestamp = $date->getTimestamp(); - } - else { + } else { $timestamp = $values[self::START_DATE]; } @@ -147,7 +142,8 @@ class StartDate extends ConditionAbstract return $toolTip; } - private function getDateFormat() { + private function getDateFormat() + { return DateTimeFormat::getInstance($this->facade->getRequest())->getFormat("date"); } @@ -177,8 +173,7 @@ class StartDate extends ConditionAbstract $date->setTimestamp($this->values[self::START_DATE]); $strDate = $date->format($this->getDateFormat()); - } - else { + } else { $strDate = ''; } @@ -189,4 +184,4 @@ class StartDate extends ConditionAbstract 'currentValue' => $strDate ]); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/CouponController.php b/core/lib/Thelia/Controller/Admin/CouponController.php index 44404d6a7..11abe29a3 100644 --- a/core/lib/Thelia/Controller/Admin/CouponController.php +++ b/core/lib/Thelia/Controller/Admin/CouponController.php @@ -157,12 +157,12 @@ class CouponController extends BaseAdminController $freeShippingForCountries = $freeShippingForModules = []; /** @var CouponCountry $item */ - foreach($coupon->getFreeShippingForCountries() as $item) { + foreach ($coupon->getFreeShippingForCountries() as $item) { $freeShippingForCountries[] = $item->getCountryId(); } /** @var CouponModule $item */ - foreach($coupon->getFreeShippingForModules() as $item) { + foreach ($coupon->getFreeShippingForModules() as $item) { $freeShippingForModules[] = $item->getModuleId(); } diff --git a/core/lib/Thelia/Core/Event/Coupon/CouponConsumeEvent.php b/core/lib/Thelia/Core/Event/Coupon/CouponConsumeEvent.php index 096efc4e9..7a9bf93b8 100644 --- a/core/lib/Thelia/Core/Event/Coupon/CouponConsumeEvent.php +++ b/core/lib/Thelia/Core/Event/Coupon/CouponConsumeEvent.php @@ -37,9 +37,9 @@ class CouponConsumeEvent extends ActionEvent /** * Constructor * - * @param string $code Coupon code - * @param float $discount Total discount given by this coupon - * @param bool $isValid If Coupon is valid or f Customer meets coupon conditions + * @param string $code Coupon code + * @param float $discount Total discount given by this coupon + * @param bool $isValid If Coupon is valid or f Customer meets coupon conditions * @param bool $freeShipping true if coupon offers free shipping */ public function __construct($code, $discount = null, $isValid = null, $freeShipping = false) @@ -57,6 +57,7 @@ class CouponConsumeEvent extends ActionEvent public function setFreeShipping($freeShipping) { $this->freeShipping = $freeShipping; + return $this; } diff --git a/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php index c6ed6627a..755dbe9f7 100644 --- a/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php @@ -134,6 +134,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent public function setPerCustomerUsageCount($perCustomerUsageCount) { $this->perCustomerUsageCount = $perCustomerUsageCount; + return $this; } @@ -146,12 +147,13 @@ class CouponCreateOrUpdateEvent extends ActionEvent } /** - * @param array $freeShippingForCountries + * @param array $freeShippingForCountries * @return $this */ public function setFreeShippingForCountries($freeShippingForCountries) { $this->freeShippingForCountries = $freeShippingForCountries; + return $this; } @@ -164,12 +166,13 @@ class CouponCreateOrUpdateEvent extends ActionEvent } /** - * @param array $freeShippingForMethods + * @param array $freeShippingForMethods * @return $this */ public function setFreeShippingForMethods($freeShippingForMethods) { $this->freeShippingForMethods = $freeShippingForMethods; + return $this; } diff --git a/core/lib/Thelia/Core/Template/Loop/Coupon.php b/core/lib/Thelia/Core/Template/Loop/Coupon.php index 5bbdcc39d..4d3a3ba29 100644 --- a/core/lib/Thelia/Core/Template/Loop/Coupon.php +++ b/core/lib/Thelia/Core/Template/Loop/Coupon.php @@ -198,13 +198,13 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface $freeShippingForCountriesIds = []; /** @var CouponCountry $couponCountry */ - foreach($coupon->getFreeShippingForCountries() as $couponCountry) { + foreach ($coupon->getFreeShippingForCountries() as $couponCountry) { $freeShippingForCountriesIds[] = $couponCountry->getCountryId(); } $freeShippingForModulesIds = []; /** @var CouponModule $couponModule */ - foreach($coupon->getFreeShippingForModules() as $couponModule) { + foreach ($coupon->getFreeShippingForModules() as $couponModule) { $freeShippingForModulesIds[] = $couponModule->getModuleId(); } diff --git a/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php b/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php index 332d2d5a8..f982f8b53 100644 --- a/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php +++ b/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php @@ -82,13 +82,13 @@ class OrderCoupon extends BaseLoop implements PropelSearchLoopInterface $freeShippingForCountriesIds = []; /** @var OrderCouponCountry $couponCountry */ - foreach($orderCoupon->getFreeShippingForCountries() as $couponCountry) { + foreach ($orderCoupon->getFreeShippingForCountries() as $couponCountry) { $freeShippingForCountriesIds[] = $couponCountry->getCountryId(); } $freeShippingForModulesIds = []; /** @var OrderCouponModule $couponModule */ - foreach($orderCoupon->getFreeShippingForModules() as $couponModule) { + foreach ($orderCoupon->getFreeShippingForModules() as $couponModule) { $freeShippingForModulesIds[] = $couponModule->getModuleId(); } diff --git a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php index e1d21d418..10155ec07 100644 --- a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php +++ b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php @@ -150,7 +150,7 @@ class SmartyAssetsManager $files = $finder->files()->in($assetSource)->name($file); if (! empty($files)) { - + $url = $this->assetsManager->processAsset( $assetSource . DS . $file, $assetSource . DS . self::$assetsDirectory, @@ -162,8 +162,7 @@ class SmartyAssetsManager $filters, $debug ); - } - else { + } else { Tlog::getInstance()->addError("Asset $assetSource".DS."$file was not found."); } diff --git a/core/lib/Thelia/Coupon/BaseFacade.php b/core/lib/Thelia/Coupon/BaseFacade.php index 3a4a74b33..0fdf0c36b 100644 --- a/core/lib/Thelia/Coupon/BaseFacade.php +++ b/core/lib/Thelia/Coupon/BaseFacade.php @@ -78,8 +78,7 @@ class BaseFacade implements FacadeInterface { try { return AddressQuery::create()->findPk($this->getRequest()->getSession()->getOrder()->getChoosenDeliveryAddress()); - } - catch(\Exception $ex) { + } catch (\Exception $ex) { throw new \LogicException("Failed to get delivery address (" . $ex->getMessage() . ")"); } } diff --git a/core/lib/Thelia/Coupon/CouponManager.php b/core/lib/Thelia/Coupon/CouponManager.php index f1b16307c..39695a2e6 100644 --- a/core/lib/Thelia/Coupon/CouponManager.php +++ b/core/lib/Thelia/Coupon/CouponManager.php @@ -23,8 +23,6 @@ use Thelia\Model\CouponCountry; use Thelia\Model\CouponCustomerCount; use Thelia\Model\CouponCustomerCountQuery; use Thelia\Model\Order; -use Thelia\Model\OrderAddress; -use Thelia\Model\OrderAddressQuery; /** * Manage how Coupons could interact with a Checkout @@ -117,7 +115,7 @@ class CouponManager $deliveryCountryId = $deliveryAddress->getCountryId(); /** @var CouponCountry $couponCountry */ - foreach($couponCountries as $couponCountry) { + foreach ($couponCountries as $couponCountry) { if ($deliveryCountryId == $couponCountry->getCountryId()) { $countryValid = true; break; @@ -140,7 +138,7 @@ class CouponManager $shippingModuleId = $order->getDeliveryModuleId(); /** @var CouponModule $couponModule */ - foreach($couponModules as $couponModule) { + foreach ($couponModules as $couponModule) { if ($shippingModuleId == $couponModule->getModuleId()) { $moduleValid = true; break; @@ -273,8 +271,8 @@ class CouponManager * * To call when a coupon is consumed * - * @param \Thelia\Model\Coupon $coupon Coupon consumed - * @param int|null $customerId the ID of the ordering customer + * @param \Thelia\Model\Coupon $coupon Coupon consumed + * @param int|null $customerId the ID of the ordering customer * * @return int Usage left after decremental */ @@ -318,8 +316,7 @@ class CouponManager ; $ret = $usageLeft - $newCount; - } - else { + } else { $usageLeft--; $coupon->setMaxUsage($usageLeft); diff --git a/core/lib/Thelia/Coupon/Type/CouponAbstract.php b/core/lib/Thelia/Coupon/Type/CouponAbstract.php index 4854e320d..424de8323 100644 --- a/core/lib/Thelia/Coupon/Type/CouponAbstract.php +++ b/core/lib/Thelia/Coupon/Type/CouponAbstract.php @@ -176,6 +176,7 @@ abstract class CouponAbstract implements CouponInterface public function setPerCustomerUsageCount($perCustomerUsageCount) { $this->perCustomerUsageCount = $perCustomerUsageCount; + return $this; } @@ -187,7 +188,6 @@ abstract class CouponAbstract implements CouponInterface return $this->perCustomerUsageCount; } - /** * Return Coupon code (ex: XMAS) * @@ -253,14 +253,16 @@ abstract class CouponAbstract implements CouponInterface /** * @return array list of country IDs for which shipping is free. All if empty */ - public function getFreeShippingForCountries() { + public function getFreeShippingForCountries() + { return $this->freeShippingForCountries; } /** * @return array list of module IDs for which shipping is free. All if empty */ - public function getFreeShippingForModules() { + public function getFreeShippingForModules() + { return $this->freeShippingForModules; } diff --git a/core/lib/Thelia/Coupon/Type/CouponInterface.php b/core/lib/Thelia/Coupon/Type/CouponInterface.php index 25ceb358c..69eca002a 100644 --- a/core/lib/Thelia/Coupon/Type/CouponInterface.php +++ b/core/lib/Thelia/Coupon/Type/CouponInterface.php @@ -15,8 +15,6 @@ namespace Thelia\Coupon\Type; use Propel\Runtime\Collection\ObjectCollection; use Thelia\Condition\ConditionCollection; use Thelia\Coupon\FacadeInterface; -use Thelia\Model\CouponCountry; -use Thelia\Model\CouponModule; /** * Represents a Coupon ready to be processed in a Checkout process @@ -51,22 +49,22 @@ interface CouponInterface /** * Set Coupon * - * @param FacadeInterface $facade Provides necessary value from Thelia - * @param string $code Coupon code (ex: XMAS) - * @param string $title Coupon title (ex: Coupon for XMAS) - * @param string $shortDescription Coupon short description - * @param string $description Coupon description - * @param array $effects Coupon effects params - * @param bool $isCumulative If Coupon is cumulative - * @param bool $isRemovingPostage If Coupon is removing postage - * @param bool $isAvailableOnSpecialOffers If available on Product already - * on special offer price - * @param bool $isEnabled False if Coupon is disabled by admin - * @param int $maxUsage How many usage left - * @param \Datetime $expirationDate When the Code is expiring + * @param FacadeInterface $facade Provides necessary value from Thelia + * @param string $code Coupon code (ex: XMAS) + * @param string $title Coupon title (ex: Coupon for XMAS) + * @param string $shortDescription Coupon short description + * @param string $description Coupon description + * @param array $effects Coupon effects params + * @param bool $isCumulative If Coupon is cumulative + * @param bool $isRemovingPostage If Coupon is removing postage + * @param bool $isAvailableOnSpecialOffers If available on Product already + * on special offer price + * @param bool $isEnabled False if Coupon is disabled by admin + * @param int $maxUsage How many usage left + * @param \Datetime $expirationDate When the Code is expiring * @param ObjectCollection $freeShippingForCountries list of countries which shipping is free. All if empty * @param ObjectCollection $freeShippingForModules list of modules for which shipping is free. All if empty - * @param bool $perCustomerUsageCount true if usage count is per customer only + * @param bool $perCustomerUsageCount true if usage count is per customer only */ public function set( FacadeInterface $facade, diff --git a/core/lib/Thelia/Form/CouponCreationForm.php b/core/lib/Thelia/Form/CouponCreationForm.php index 3c6d151c9..8bc50af1a 100644 --- a/core/lib/Thelia/Form/CouponCreationForm.php +++ b/core/lib/Thelia/Form/CouponCreationForm.php @@ -18,13 +18,10 @@ use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotEqualTo; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Core\Translation\Translator; -use Thelia\Model\Base\CountryI18n; use Thelia\Model\Base\CountryQuery; use Thelia\Model\Base\LangQuery; use Thelia\Model\Base\ModuleQuery; -use Thelia\Model\CountryI18nQuery; use Thelia\Model\Module; -use Thelia\Model\ModuleI18nQuery; use Thelia\Module\BaseModule; /** @@ -49,7 +46,7 @@ class CouponCreationForm extends BaseForm $list = CountryQuery::create()->find(); /** @var Country $item */ - foreach($list as $item) { + foreach ($list as $item) { $countries[$item->getId()] = $item->getTitle(); } @@ -62,7 +59,7 @@ class CouponCreationForm extends BaseForm $list = ModuleQuery::create()->filterByActivate(BaseModule::IS_ACTIVATED)->filterByType(BaseModule::DELIVERY_MODULE_TYPE)->find(); /** @var Module $item */ - foreach($list as $item) { + foreach ($list as $item) { $modules[$item->getId()] = $item->getTitle(); } diff --git a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php index 3c863f838..bf1f7adbd 100644 --- a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php +++ b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php @@ -19,7 +19,6 @@ use Thelia\Condition\Implementation\MatchForTotalAmount; use Thelia\Condition\Operators; use Thelia\Coupon\Type\RemoveXAmount; use Thelia\Model\Coupon; -use Thelia\Model\CouponCountry; use Thelia\Model\CurrencyQuery; use Thelia\Model\Order;