Returns the target command name based on received gateway event type.

@param string $eventType
@return string|null
344478
public function getTargetCommandName($eventType) {
        $eventParts = explode('.', $eventType);
        $command    = null;

        if( array_key_exists(1, $eventParts)) {
            $command = self::$map[ $eventParts[1] ] ?? null;
        }

        return $command;
    }
1358006
public static Event map(EventType eventType) {
        Event event = new Event();
        event.setEventType(mapEventTypeEnum(eventType.getEventType()));
        Date date = (eventType.getTimestamp() == null)
                ? new Date() : eventType.getTimestamp().toGregorianCalendar().getTime();
        event.setTimestamp(date);
        event.setOriginator(mapOriginatorType(eventType.getOriginator()));
        MessageInfo messageInfo = mapMessageInfo(eventType.getMessageInfo());
        event.setMessageInfo(messageInfo);
        String content = mapContent(eventType.getContent());
        event.setContent(content);
        event.getCustomInfo().clear();
        event.getCustomInfo().putAll(mapCustomInfo(eventType.getCustomInfo()));
        return event;
    }
380812
private EventCallBackStruct getEventCallBackStruct(String eventName) {
        Enumeration keys = event_callback_map.keys();
        while (keys.hasMoreElements()) {
            String key = (String) keys.nextElement();
            //  Notifd do not use tango host
            int start = key.indexOf('/', "tango:// ".length());
            String shortName = key.substring(start+1);
            if (eventName.equalsIgnoreCase(shortName)) {
                return event_callback_map.get(key);
            }
        }
        return null;
    }
820838
public static function check($class, $eventType) 
  {
    $class = preg_replace("/Catapult\\\/", "", get_class($class));

    /** does the event exist ? **/
    if (array_key_exists($class, self::$events)) {

      if (in_array($eventType, self::$events[$class])) {
        return true;
      }
    }

    return false;
  }
142957
public function trigger($eventType, $params)
    {
        if (isset($this->eventList[$eventType]) && is_array($this->eventList[$eventType])) {
            foreach ($this->eventList[$eventType] as $callbackDescriptor) {
                call_user_func_array($callbackDescriptor['cb'], $params);
            }
        }
    }
529244
public function unsubscribe($eventType, $callbackId)
    {
        $success = false;
        if (!isset($this->eventList[$eventType]) || !is_array($this->eventList[$eventType])) {
            $this->eventList[$eventType] = array_filter(
                $this->eventList[$eventType],
                function ($cb) use ($callbackId) {
                    return $cb['id'] !== $callbackId;
                }
            );
            $success = true;
        }
        return $success;
    }
743755
public function getEventLogInfo(Event $event, $eventName)
    {
        $this->default = array(
            'type' => $eventName,
            'description' => $eventName,
        );

        if (!isset($this->commands[$eventName])) {
            return $this->default;
        }

        return $this->getEventLogDetails($event, $this->commands[$eventName]);
    }
250583
public function getEventLog(Event $event, $eventName)
    {
        $eventLog = $this->getEventLogObject($this->getEventLogInfo($event, $eventName));

        if (null === $eventLog) {
            return null;
        }

        $eventLog->setTypeId($eventName);
        $eventLog->setIp($this->getClientIp());
        $eventLog->setEventTime(new \DateTime());
        $this->setUser($eventLog);

        return $eventLog;
    }
1371484
private static EventTypeEnum mapEventTypeEnum(EventEnumType eventType) {
        if (eventType != null) {
            return EventTypeEnum.valueOf(eventType.name());
        }
        return EventTypeEnum.UNKNOWN;
    }
734620
public static function getName($type)
    {
        switch ($type) {
            case static::T_UNSPECIFIED:
                return 'Unspecified/unknown address';
            case static::T_RESERVED:
                 return 'Reserved/internal use only';
            case static::T_THISNETWORK:
                 return 'Refer to source hosts on "this" network';
            case static::T_LOOPBACK:
                 return 'Internet host loopback address';
            case static::T_ANYCASTRELAY:
                 return 'Relay anycast address';
            case static::T_LIMITEDBROADCAST:
                 return '"Limited broadcast" destination address';
            case static::T_MULTICAST:
                 return 'Multicast address assignments - Indentify a group of interfaces';
            case static::T_LINKLOCAL:
                 return '"Link local" address, allocated for communication between hosts on a single link';
            case static::T_LINKLOCAL_UNICAST:
                return 'Link local unicast / Linked-scoped unicast';
            case static::T_DISCARDONLY:
                 return 'Discard only';
            case static::T_DISCARD:
                 return 'Discard';
            case static::T_PRIVATENETWORK:
                 return 'For use in private networks';
            case static::T_PUBLIC:
                 return 'Public address';
            default:
                return $type === null ? 'Unknown type' : sprintf('Unknown type (%s)', $type);
        }
    }
431380
@Beta
    public boolean containsCustomEventMappingFor(final String eventType) {
        if (eventType == null || eventType.isEmpty()) {
            return false;
        } else {
            return this.eventTypeToEventDataMapping.containsKey(canonicalizeEventType(eventType));
        }
    }
963204
public function setEventType($eventType) {
        $this->setVariable(self::EVENT_TYPE, $this->assembleAssignmentString(self::DATA_EVENT, $eventType));
    }
1210799
protected function getEventPriority($eventName)
    {
        $suffix = $this->getEventSuffix($eventName);

        if ($suffix === static::UPDATE) {
            return 9999;
        } elseif ($suffix === static::INSERT) {
            return 9998;
        } elseif ($suffix === static::DELETE) {
            return 9997;
        }

        return parent::getEventPriority($eventName);
    }
846449
protected function sortListeners($eventType)
    {
        krsort($this->listeners[$eventType]);
        $this->sorted[$eventType] = call_user_func_array('array_merge', $this->listeners[$eventType]);
    }
451780
protected function getSessionMessage(&$messageType = null)
    {
        $session = $this->getRequest()->getSession();
        $message = $session->get('Security.Message.message');
        $messageType = null;
        if (empty($message)) {
            return null;
        }

        $messageType = $session->get('Security.Message.type');
        $messageCast = $session->get('Security.Message.cast');
        if ($messageCast !== ValidationResult::CAST_HTML) {
            $message = Convert::raw2xml($message);
        }

        return sprintf('<p class="message %s">%s</p>', Convert::raw2att($messageType), $message);
    }
1312146
private function buildEventAggregate(array $events, $returnType)
    {
        if ($returnType === self::RETURN_AS_ARRAY) {
            return $this->buildEventAggregateAsArray($events);
        }

        return $this->buildEventAggregateAsObject($events);
    }
175863
protected function getEventOutput(Event $event)
    {
        if (! $event->output ||
            $event->output === $event->getDefaultOutput() ||
            $event->shouldAppendOutput ||
            ! file_exists($event->output)) {
            return '';
        }

        return trim(file_get_contents($event->output));
    }