public function getOutputMessageFromResult(TaskResult $taskResult) { try { $return = $taskResult->getResult(); $serializedReturn = serialize($return); $data = 'r' . $serializedReturn; } catch (\Exception $exception) { $serializedException = serialize([get_class($exception), $exception->getMessage(), $exception->getCode(), $exception->getFile(), $exception->getLine()]); $data = 'e' . $serializedException; } return new OutputMessage($data); }