1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50:
<?php
namespace SAREhub\Client\Event;
class EventLegacyHelper
{
const EXTRA = 'extra';
const START_PARAMS = 'start_params';
public static function copyFromEventToEvent(BasicEvent $input, BasicEvent $output)
{
if ($input->hasProperty(self::EXTRA)) {
$output->withProperty(self::EXTRA, $input->getProperty(self::EXTRA));
}
if ($input->hasProperty(self::START_PARAMS)) {
$output->withProperty(self::START_PARAMS, $input->getProperty(self::START_PARAMS));
}
}
public static function copyFromDataToEvent(array $eventData, BasicEvent $event)
{
if (isset($eventData[self::EXTRA])) {
$event->withProperty(self::EXTRA, $eventData[self::EXTRA]);
}
if (isset($eventData[self::START_PARAMS])) {
$event->withProperty(self::START_PARAMS, $eventData[self::START_PARAMS]);
}
}
public static function copyFromEventToEventData(BasicEvent $event, array &$eventData)
{
if ($event->hasProperty(self::EXTRA)) {
$eventData[self::EXTRA] = $event->getProperty(self::EXTRA);
}
if ($event->hasProperty(self::START_PARAMS)) {
$eventData[self::START_PARAMS] = $event->getProperty(self::START_PARAMS);
}
$properties = $event->getProperties();
unset($properties[self::EXTRA]);
unset($properties[self::START_PARAMS]);
$event->withProperties($properties);
}
}