/** * Execute event in set process for set payload * If final state has timeout event, store it for further execution * Return run history * * @param ProcessInterface $process * @param PayloadInterface $payload * @param string $event * * @return array */ private function resolveEvent(ProcessInterface $process, PayloadInterface $payload, $event) { $result = $process->triggerEvent($event, $payload); if ($payload->hasChanged() && $process->hasTimeout($payload)) { $this->timeoutHandler->store($process->getTimeout($payload, new \DateTime())); } $this->payloadHandler->store($payload); return $result; }