Working cleaning
This commit is contained in:
@@ -82,10 +82,6 @@ class ConditionFactory
|
||||
if ($conditions !== null) {
|
||||
/** @var $condition ConditionManagerInterface */
|
||||
foreach ($conditions as $condition) {
|
||||
// Remove all condition if the "no condition" condition is found
|
||||
// if ($condition->getServiceId() == 'thelia.condition.match_for_everyone') {
|
||||
// return base64_encode(json_encode(array($condition->getSerializableRule())));
|
||||
// }
|
||||
$serializableConditions[] = $condition->getSerializableCondition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,6 @@ use Thelia\Type\FloatType;
|
||||
*/
|
||||
abstract class ConditionManagerAbstract implements ConditionManagerInterface
|
||||
{
|
||||
// /** Operator key in $validators */
|
||||
// CONST OPERATOR = 'operator';
|
||||
// /** Value key in $validators */
|
||||
// CONST VALUE = 'value';
|
||||
|
||||
/** @var string Service Id from Resources/config.xml */
|
||||
protected $serviceId = null;
|
||||
@@ -57,9 +53,6 @@ abstract class ConditionManagerAbstract implements ConditionManagerInterface
|
||||
/** @var array Parameters validating parameters against */
|
||||
protected $validators = array();
|
||||
|
||||
// /** @var array Parameters to be validated */
|
||||
// protected $paramsToValidate = array();
|
||||
|
||||
/** @var FacadeInterface Provide necessary value from Thelia */
|
||||
protected $adapter = null;
|
||||
|
||||
@@ -87,62 +80,6 @@ abstract class ConditionManagerAbstract implements ConditionManagerInterface
|
||||
$this->conditionValidator = $adapter->getConditionEvaluator();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Check validator relevancy and store them
|
||||
// *
|
||||
// * @param array $validators Array of RuleValidator
|
||||
// * validating $paramsToValidate against
|
||||
// *
|
||||
// * @return $this
|
||||
// * @throws InvalidConditionException
|
||||
// */
|
||||
// protected function setValidators(array $validators)
|
||||
// {
|
||||
// foreach ($validators as $validator) {
|
||||
// if (!$validator instanceof RuleValidator) {
|
||||
// throw new InvalidConditionException(get_class());
|
||||
// }
|
||||
// if (!in_array($validator->getOperator(), $this->availableOperators)) {
|
||||
// throw new InvalidConditionOperatorException(
|
||||
// get_class(),
|
||||
// $validator->getOperator()
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// $this->validators = $validators;
|
||||
//
|
||||
// return $this;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * Check if the current Checkout matches this condition
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public function isMatching()
|
||||
// {
|
||||
// $this->checkBackOfficeInput();
|
||||
// $this->checkCheckoutInput();
|
||||
//
|
||||
// $isMatching = true;
|
||||
// /** @var $validator RuleValidator*/
|
||||
// foreach ($this->validators as $param => $validator) {
|
||||
// $a = $this->paramsToValidate[$param];
|
||||
// $operator = $validator->getOperator();
|
||||
// /** @var ComparableInterface, RuleParameterAbstract $b */
|
||||
// $b = $validator->getParam();
|
||||
//
|
||||
// if (!Operators::isValid($a, $operator, $b)) {
|
||||
// $isMatching = false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return $isMatching;
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return all available Operators for this Condition
|
||||
*
|
||||
@@ -153,37 +90,6 @@ abstract class ConditionManagerAbstract implements ConditionManagerInterface
|
||||
return $this->availableOperators;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Check if Operators set for this Rule in the BackOffice are legit
|
||||
// *
|
||||
// * @throws InvalidConditionOperatorException if Operator is not allowed
|
||||
// * @return bool
|
||||
// */
|
||||
// protected function checkBackOfficeInputsOperators()
|
||||
// {
|
||||
// /** @var RuleValidator $param */
|
||||
// foreach ($this->validators as $key => $param) {
|
||||
// $operator = $param->getOperator();
|
||||
// if (!isset($operator)
|
||||
// ||!in_array($operator, $this->availableOperators)
|
||||
// ) {
|
||||
// throw new InvalidConditionOperatorException(get_class(), $key);
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Generate current Rule param to be validated from adapter
|
||||
// *
|
||||
// * @throws \Thelia\Exception\NotImplementedException
|
||||
// * @return $this
|
||||
// */
|
||||
// protected function setParametersToValidate()
|
||||
// {
|
||||
// throw new \Thelia\Exception\NotImplementedException();
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return all validators
|
||||
*
|
||||
|
||||
@@ -53,20 +53,6 @@ interface ConditionManagerInterface
|
||||
*/
|
||||
public function getServiceId();
|
||||
|
||||
// /**
|
||||
// * Check if backoffice inputs are relevant or not
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public function checkBackOfficeInput();
|
||||
|
||||
// /**
|
||||
// * Check if Checkout inputs are relevant or not
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public function checkCheckoutInput();
|
||||
|
||||
/**
|
||||
* Check validators relevancy and store them
|
||||
*
|
||||
@@ -78,13 +64,6 @@ interface ConditionManagerInterface
|
||||
*/
|
||||
public function setValidatorsFromForm(array $operators, array $values);
|
||||
|
||||
// /**
|
||||
// * Check if the current Checkout matches this condition
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public function isMatching();
|
||||
|
||||
/**
|
||||
* Test if the current application state matches conditions
|
||||
*
|
||||
@@ -121,17 +100,6 @@ interface ConditionManagerInterface
|
||||
*/
|
||||
public function getValidators();
|
||||
|
||||
// /**
|
||||
// * Populate a Condition from a form admin
|
||||
// *
|
||||
// * @param array $operators Condition Operator set by the Admin
|
||||
// * @param array $values Condition Values set by the Admin
|
||||
// *
|
||||
// * @return bool
|
||||
// */
|
||||
// public function populateFromForm(array$operators, array $values);
|
||||
|
||||
|
||||
/**
|
||||
* Return a serializable Condition
|
||||
*
|
||||
|
||||
@@ -45,33 +45,4 @@ class SerializableCondition
|
||||
/** @var array Values set by Admin for this Condition */
|
||||
public $values = array();
|
||||
|
||||
// /**
|
||||
// * Get Operators set by Admin for this Condition
|
||||
// *
|
||||
// * @return array
|
||||
// */
|
||||
// public function getOperators()
|
||||
// {
|
||||
// return $this->operators;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Get Condition Service id
|
||||
// *
|
||||
// * @return string
|
||||
// */
|
||||
// public function getConditionServiceId()
|
||||
// {
|
||||
// return $this->conditionServiceId;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Get Values set by Admin for this Condition
|
||||
// *
|
||||
// * @return array
|
||||
// */
|
||||
// public function getValues()
|
||||
// {
|
||||
// return $this->values;
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user