code: public function addEvent($eventName, $data = null)
      {
          $eventId = uniqid('event', true);
          $this->state[self::VAR_EVENTS_QUEUE][$eventId] = [
              'id' => $eventId,
              'timestamp' => microtime(true),
              'user' => \common_session_SessionManager::getSession()->getUserUri(),
              'type' => $eventName,
              'data' => $data,
          ];
          return $eventId;
      }
docs: Add an event on top of the queue
  @param string $eventName
  @param mixed $data
  @return string
  @throws \common_Exception