Applied php-cs-fixer
This commit is contained in:
@@ -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
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() . ', ';
|
||||
}
|
||||
|
||||
|
||||
@@ -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() . ', ';
|
||||
}
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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().'), ';
|
||||
}
|
||||
|
||||
|
||||
@@ -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% <strong>%countries_list%</strong>', [
|
||||
'%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'
|
||||
);
|
||||
|
||||
@@ -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% <strong>%countries_list%</strong>', [
|
||||
'%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'
|
||||
);
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Thelia\Condition\Implementation;
|
||||
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Exception\InvalidConditionOperatorException;
|
||||
use Thelia\Exception\InvalidConditionValueException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user