/** * Return single integer value that represents the event type * @param KalturaEvent $event * @return int */ protected function getEventType(KalturaEvent $event) { $matches = null; if (!preg_match('/k(\\w+)Event/', get_class($event), $matches)) { return null; } $typeName = $matches[1]; $constName = strtoupper(preg_replace('/(?!^)[[:upper:]]/', '_\\0', $typeName)); if (defined("EventNotificationEventType::{$constName}")) { $type = constant("EventNotificationEventType::{$constName}"); if ($type) { return $type; } } return DynamicEnumPeer::retrieveValueByEnumValueName('EventNotificationEventType', $constName); }
/** * Return single integer value that represents the event object type * @param KalturaEvent $event * @return int */ protected function getEventObjectType(KalturaEvent $event) { if ($event instanceof kBatchJobStatusEvent) { return EventNotificationEventObjectType::BATCHJOB; } if (!method_exists($event, 'getObject')) { return null; } $object = $event->getObject(); $constName = strtoupper(get_class($object)); if (defined("EventNotificationEventObjectType::{$constName}")) { $type = constant("EventNotificationEventObjectType::{$constName}"); if ($type) { return $type; } } return DynamicEnumPeer::retrieveValueByEnumValueName('EventNotificationEventObjectType', $constName); }