Applied php-cs-fixer

This commit is contained in:
Franck Allimant
2014-05-17 10:24:22 +02:00
parent f8ccea1899
commit ef142ca077
23 changed files with 76 additions and 88 deletions

View File

@@ -28,8 +28,6 @@ use Thelia\Coupon\Type\CouponInterface;
use Thelia\Model\Coupon as CouponModel; use Thelia\Model\Coupon as CouponModel;
use Thelia\Model\CouponCountry; use Thelia\Model\CouponCountry;
use Thelia\Model\CouponCountryQuery; use Thelia\Model\CouponCountryQuery;
use Thelia\Model\CouponCustomerCount;
use Thelia\Model\CouponCustomerCountQuery;
use Thelia\Model\CouponModule; use Thelia\Model\CouponModule;
use Thelia\Model\CouponModuleQuery; use Thelia\Model\CouponModuleQuery;
use Thelia\Model\CouponQuery; use Thelia\Model\CouponQuery;
@@ -334,8 +332,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
} }
$con->commit(); $con->commit();
} } catch (\Exception $ex) {
catch (\Exception $ex) {
$con->rollBack(); $con->rollBack();
throw($ex); throw($ex);

View File

@@ -44,9 +44,9 @@ abstract class AbstractMatchCountries extends ConditionAbstract
parent::__construct($facade); parent::__construct($facade);
} }
protected abstract function getSummaryLabel($cntryStrList, $i18nOperator); abstract protected function getSummaryLabel($cntryStrList, $i18nOperator);
protected abstract function getFormLabel(); abstract protected function getFormLabel();
/** /**
* @inheritdoc * @inheritdoc
@@ -87,6 +87,7 @@ abstract class AbstractMatchCountries extends ConditionAbstract
// The delivery address should match one of the selected countries. // The delivery address should match one of the selected countries.
/* TODO !!!! */ /* TODO !!!! */
return $this->conditionValidator->variableOpComparison( return $this->conditionValidator->variableOpComparison(
$this->facade->getNbArticlesInCart(), $this->facade->getNbArticlesInCart(),
$this->operators[self::COUNTRIES_LIST], $this->operators[self::COUNTRIES_LIST],

View File

@@ -99,7 +99,6 @@ class CartContainsProducts extends ConditionAbstract
$cartItem->getProduct()->getId(), $cartItem->getProduct()->getId(),
$this->operators[self::PRODUCTS_LIST], $this->operators[self::PRODUCTS_LIST],
$this->values[self::PRODUCTS_LIST])) { $this->values[self::PRODUCTS_LIST])) {
return true; return true;
} }
} }

View File

@@ -73,8 +73,8 @@ abstract class ConditionAbstract implements ConditionInterface
* *
* @throws \Thelia\Exception\InvalidConditionOperatorException if the operator value is not in the allowed value * @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( $isOperator1Legit = $this->isOperatorLegit(
$operatorList[$parameterName], $operatorList[$parameterName],
$this->availableOperators[$parameterName] $this->availableOperators[$parameterName]

View File

@@ -69,8 +69,8 @@ class MatchBillingCountries extends AbstractMatchCountries
return $toolTip; return $toolTip;
} }
protected function getSummaryLabel($cntryStrList, $i18nOperator) { protected function getSummaryLabel($cntryStrList, $i18nOperator)
{
return $this->translator->trans( return $this->translator->trans(
'Only if order billing country is %op% <strong>%countries_list%</strong>', [ 'Only if order billing country is %op% <strong>%countries_list%</strong>', [
'%countries_list%' => $cntryStrList, '%countries_list%' => $cntryStrList,
@@ -79,7 +79,8 @@ class MatchBillingCountries extends AbstractMatchCountries
); );
} }
protected function getFormLabel() { protected function getFormLabel()
{
return $this->translator->trans( return $this->translator->trans(
'Billing coutry is', [], 'condition' 'Billing coutry is', [], 'condition'
); );

View File

@@ -69,8 +69,8 @@ class MatchDeliveryCountries extends AbstractMatchCountries
return $toolTip; return $toolTip;
} }
protected function getSummaryLabel($cntryStrList, $i18nOperator) { protected function getSummaryLabel($cntryStrList, $i18nOperator)
{
return $this->translator->trans( return $this->translator->trans(
'Only if order shipping country is %op% <strong>%countries_list%</strong>', [ 'Only if order shipping country is %op% <strong>%countries_list%</strong>', [
'%countries_list%' => $cntryStrList, '%countries_list%' => $cntryStrList,
@@ -79,7 +79,8 @@ class MatchDeliveryCountries extends AbstractMatchCountries
); );
} }
protected function getFormLabel() { protected function getFormLabel()
{
return $this->translator->trans( return $this->translator->trans(
'Delivery coutry is', [], 'condition' 'Delivery coutry is', [], 'condition'
); );

View File

@@ -26,8 +26,8 @@ class MatchForEveryone extends ConditionAbstract
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function __construct(FacadeInterface $facade) { public function __construct(FacadeInterface $facade)
{
// Define the allowed comparison operators // Define the allowed comparison operators
$this->availableOperators = []; $this->availableOperators = [];

View File

@@ -14,7 +14,6 @@ namespace Thelia\Condition\Implementation;
use Thelia\Condition\Operators; use Thelia\Condition\Operators;
use Thelia\Coupon\FacadeInterface; use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionOperatorException;
use Thelia\Exception\InvalidConditionValueException; use Thelia\Exception\InvalidConditionValueException;
/** /**

View File

@@ -14,11 +14,7 @@ namespace Thelia\Condition\Implementation;
use Thelia\Condition\Operators; use Thelia\Condition\Operators;
use Thelia\Coupon\FacadeInterface; use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionOperatorException;
use Thelia\Exception\InvalidConditionValueException; use Thelia\Exception\InvalidConditionValueException;
use Thelia\Model\Category;
use Thelia\Model\CategoryImageQuery;
use Thelia\Model\CategoryQuery;
use Thelia\Tools\DateTimeFormat; use Thelia\Tools\DateTimeFormat;
/** /**
@@ -76,8 +72,7 @@ class StartDate extends ConditionAbstract
} }
$timestamp = $date->getTimestamp(); $timestamp = $date->getTimestamp();
} } else {
else {
$timestamp = $values[self::START_DATE]; $timestamp = $values[self::START_DATE];
} }
@@ -147,7 +142,8 @@ class StartDate extends ConditionAbstract
return $toolTip; return $toolTip;
} }
private function getDateFormat() { private function getDateFormat()
{
return DateTimeFormat::getInstance($this->facade->getRequest())->getFormat("date"); return DateTimeFormat::getInstance($this->facade->getRequest())->getFormat("date");
} }
@@ -177,8 +173,7 @@ class StartDate extends ConditionAbstract
$date->setTimestamp($this->values[self::START_DATE]); $date->setTimestamp($this->values[self::START_DATE]);
$strDate = $date->format($this->getDateFormat()); $strDate = $date->format($this->getDateFormat());
} } else {
else {
$strDate = ''; $strDate = '';
} }

View File

@@ -57,6 +57,7 @@ class CouponConsumeEvent extends ActionEvent
public function setFreeShipping($freeShipping) public function setFreeShipping($freeShipping)
{ {
$this->freeShipping = $freeShipping; $this->freeShipping = $freeShipping;
return $this; return $this;
} }

View File

@@ -134,6 +134,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
public function setPerCustomerUsageCount($perCustomerUsageCount) public function setPerCustomerUsageCount($perCustomerUsageCount)
{ {
$this->perCustomerUsageCount = $perCustomerUsageCount; $this->perCustomerUsageCount = $perCustomerUsageCount;
return $this; return $this;
} }
@@ -152,6 +153,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
public function setFreeShippingForCountries($freeShippingForCountries) public function setFreeShippingForCountries($freeShippingForCountries)
{ {
$this->freeShippingForCountries = $freeShippingForCountries; $this->freeShippingForCountries = $freeShippingForCountries;
return $this; return $this;
} }
@@ -170,6 +172,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
public function setFreeShippingForMethods($freeShippingForMethods) public function setFreeShippingForMethods($freeShippingForMethods)
{ {
$this->freeShippingForMethods = $freeShippingForMethods; $this->freeShippingForMethods = $freeShippingForMethods;
return $this; return $this;
} }

View File

@@ -162,8 +162,7 @@ class SmartyAssetsManager
$filters, $filters,
$debug $debug
); );
} } else {
else {
Tlog::getInstance()->addError("Asset $assetSource".DS."$file was not found."); Tlog::getInstance()->addError("Asset $assetSource".DS."$file was not found.");
} }

View File

@@ -78,8 +78,7 @@ class BaseFacade implements FacadeInterface
{ {
try { try {
return AddressQuery::create()->findPk($this->getRequest()->getSession()->getOrder()->getChoosenDeliveryAddress()); 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() . ")"); throw new \LogicException("Failed to get delivery address (" . $ex->getMessage() . ")");
} }
} }

View File

@@ -23,8 +23,6 @@ use Thelia\Model\CouponCountry;
use Thelia\Model\CouponCustomerCount; use Thelia\Model\CouponCustomerCount;
use Thelia\Model\CouponCustomerCountQuery; use Thelia\Model\CouponCustomerCountQuery;
use Thelia\Model\Order; use Thelia\Model\Order;
use Thelia\Model\OrderAddress;
use Thelia\Model\OrderAddressQuery;
/** /**
* Manage how Coupons could interact with a Checkout * Manage how Coupons could interact with a Checkout
@@ -318,8 +316,7 @@ class CouponManager
; ;
$ret = $usageLeft - $newCount; $ret = $usageLeft - $newCount;
} } else {
else {
$usageLeft--; $usageLeft--;
$coupon->setMaxUsage($usageLeft); $coupon->setMaxUsage($usageLeft);

View File

@@ -176,6 +176,7 @@ abstract class CouponAbstract implements CouponInterface
public function setPerCustomerUsageCount($perCustomerUsageCount) public function setPerCustomerUsageCount($perCustomerUsageCount)
{ {
$this->perCustomerUsageCount = $perCustomerUsageCount; $this->perCustomerUsageCount = $perCustomerUsageCount;
return $this; return $this;
} }
@@ -187,7 +188,6 @@ abstract class CouponAbstract implements CouponInterface
return $this->perCustomerUsageCount; return $this->perCustomerUsageCount;
} }
/** /**
* Return Coupon code (ex: XMAS) * 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 * @return array list of country IDs for which shipping is free. All if empty
*/ */
public function getFreeShippingForCountries() { public function getFreeShippingForCountries()
{
return $this->freeShippingForCountries; return $this->freeShippingForCountries;
} }
/** /**
* @return array list of module IDs for which shipping is free. All if empty * @return array list of module IDs for which shipping is free. All if empty
*/ */
public function getFreeShippingForModules() { public function getFreeShippingForModules()
{
return $this->freeShippingForModules; return $this->freeShippingForModules;
} }

View File

@@ -15,8 +15,6 @@ namespace Thelia\Coupon\Type;
use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Collection\ObjectCollection;
use Thelia\Condition\ConditionCollection; use Thelia\Condition\ConditionCollection;
use Thelia\Coupon\FacadeInterface; use Thelia\Coupon\FacadeInterface;
use Thelia\Model\CouponCountry;
use Thelia\Model\CouponModule;
/** /**
* Represents a Coupon ready to be processed in a Checkout process * Represents a Coupon ready to be processed in a Checkout process

View File

@@ -18,13 +18,10 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotEqualTo; use Symfony\Component\Validator\Constraints\NotEqualTo;
use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
use Thelia\Model\Base\CountryI18n;
use Thelia\Model\Base\CountryQuery; use Thelia\Model\Base\CountryQuery;
use Thelia\Model\Base\LangQuery; use Thelia\Model\Base\LangQuery;
use Thelia\Model\Base\ModuleQuery; use Thelia\Model\Base\ModuleQuery;
use Thelia\Model\CountryI18nQuery;
use Thelia\Model\Module; use Thelia\Model\Module;
use Thelia\Model\ModuleI18nQuery;
use Thelia\Module\BaseModule; use Thelia\Module\BaseModule;
/** /**

View File

@@ -19,7 +19,6 @@ use Thelia\Condition\Implementation\MatchForTotalAmount;
use Thelia\Condition\Operators; use Thelia\Condition\Operators;
use Thelia\Coupon\Type\RemoveXAmount; use Thelia\Coupon\Type\RemoveXAmount;
use Thelia\Model\Coupon; use Thelia\Model\Coupon;
use Thelia\Model\CouponCountry;
use Thelia\Model\CurrencyQuery; use Thelia\Model\CurrencyQuery;
use Thelia\Model\Order; use Thelia\Model\Order;