/** * @param ActionDto $dto * @return null */ public function processAction(ActionDto $dto) { $container = Registry::get('container'); $commandName = $dto->get('command'); /** @var CommandHandlerInterface $command */ $command = $container['command_' . $commandName]; if (null === $command) { return; } $command->processCommand($dto->get('args'), $dto->get('channel')); }
/** * @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); } }
/** * @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 */ public function processAction(ActionDto $dto) { $this->dtoData = $dto->getData(); $recipient = $dto->get('recipient'); $this->recipientId = $this->slackFacade->getUserIdByName(str_replace('@', '', $recipient)); $messages = $dto->get('messages'); // 1. Send "before" message $beforeMessage = Ar::get($messages, 'before'); if (null !== $beforeMessage) { $this->slackFacade->getSlackApi()->chatPostMessage($this->recipientId, $beforeMessage); } // 2. Register timed message handler $this->handlerId = uniqid(); $start = time(); $finish = $start + $this->getTimeoutSize($dto->get('timeout')); $this->coreProcessor->addTimedMessageHandler($this->handlerId, [$this, 'checker'], [$this, 'handler'], $start, $finish); }
/** * @param ActionDto $dto * @return null */ public function processAction(ActionDto $dto) { $recipients = preg_split('/\\s*,\\s*/', $dto->get('recipients')); if (0 === count($recipients)) { return; } $recipientIds = []; foreach ($recipients as $recipient) { if ($recipient !== null) { $recipientIds[] = $this->slackFacade->getRecipientIdByName($recipient); } } if (0 === count($recipientIds)) { return; } $message = $dto->getMessage(); $message = $this->substituteVariables($message); $dto->setData(array_merge($dto->getData(), ['message' => $message])); $this->outputManager->sendMessage($dto); }