Skip to content

Commit

Permalink
Fixed reset method usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Idolov authored and adrian-martinez-interactiv4 committed May 8, 2018
1 parent 79b74b6 commit 4276a24
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/code/Magento/Rule/Model/Condition/AbstractCondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ public function __construct(Context $context, array $data = [])

$options = $this->getAttributeOptions();
if ($options) {
$this->setAttribute(key(reset($options)));
reset($options);
$this->setAttribute(key($options));
}
$options = $this->getOperatorOptions();
if ($options) {
$this->setOperator(key(reset($options)));
reset($options);
$this->setOperator(key($options));
}
}

Expand Down Expand Up @@ -506,7 +508,8 @@ public function getAttributeElement()
if (null === $this->getAttribute()) {
$options = $this->getAttributeOption();
if ($options) {
$this->setAttribute(key(reset($options)));
reset($options);
$this->setAttribute(key($options));
}
}
return $this->getForm()->addField(
Expand Down Expand Up @@ -542,7 +545,7 @@ public function getOperatorElement()
{
$options = $this->getOperatorSelectOptions();
if ($this->getOperator() === null) {
$option = current(reset($options));
$option = reset($options);
$this->setOperator($option['value']);
}

Expand Down

0 comments on commit 4276a24

Please sign in to comment.