/** * @param ActionDto $dto * @return null */ public function processAction(ActionDto $dto) { if ($this->conditionResolver->isConditionMet($dto->get('condition'), Variables::all())) { $this->processActions($dto->get('then')); } else { $else = $dto->get('else'); if (is_array($else) && count($else) > 0) { $this->processActions($else); } } }
/** * @param ActionDto $dto * @return null */ private function processUntilLoop(ActionDto $dto) { $actions = $dto->get('actions'); while (!$this->conditionResolver->isConditionMet($dto->get('condition'), Variables::all())) { if (true === Variables::get('flowcontrol.continue')) { Variables::remove('flowcontrol.continue'); continue; } if (true === Variables::get('flowcontrol.break')) { Variables::remove('flowcontrol.break'); break; } $this->processActions($actions); } }
/** * @test * @dataProvider invalidConditionsProvider * @expectedException \LogicException */ public function shouldThrowExceptionOnInvalidCondition($condition, $variables, $exceptionName) { $this->setExpectedException($exceptionName); $resolver = new ConditionResolver(); $resolver->isConditionMet($condition, $variables); }