/** * @param array $actions */ protected function processActions($actions) { foreach ($actions as $action) { if (true === Variables::get('flowcontrol.continue')) { break; } if (true === Variables::get('flowcontrol.break')) { break; } $actionDto = $this->createActionDto(); $this->populateActionDto($actionDto, $action); $this->coreProcessor->processAction($actionDto); } }
/** * @param ActionDto $dto * @return null */ public function processAction(ActionDto $dto) { $name = $dto->get('name'); $value = $dto->get('value'); switch ((string) $value) { case 'increment': Variables::set($name, Variables::get($name) + 1); break; case 'decrement': Variables::set($name, Variables::get($name) - 1); break; default: Variables::set($name, $value); } }
/** * @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 */ public function shouldReturnNullOnNonExistentKey() { $this->assertEquals(null, Variables::get('test1')); }