/** @test */ public function shouldClearAllVariableValues() { Variables::clear(); Variables::set('test1', '123'); Variables::set('test2', '456'); Variables::clear(); $this->assertEquals([], Variables::all()); }
/** * @param string|null $string * @return string */ private function substituteVariables($string) { $vars = Variables::all(); if (0 === count($vars)) { return $string; } foreach ($vars as $name => $value) { $string = str_replace($name, $value, $string); } return $string; }
/** * @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); } }