* @license PHP License * @package WB */ WBClass::load('WBEvent_Handler_Newsletter_Subscriber'); /** * WBEvent_Handler_Newsletter_Subscriber_ITS * * Subscribe from ticket * * @version 0.1.0 * @package WB */ class WBEvent_Handler_Newsletter_Subscriber_ITS extends WBEvent_Handler_Newsletter_Subscriber { /** * Map Event Data To Subscriber Data * * @param WBEvent * @return array */ protected function mapEvent2Data(WBEvent $e) { $data = $e->get(); unset($data['title']); foreach ($data as $k => $v) { if ('customername' == $k) { $v = explode(' ', $v); $data['surname'] = array_pop($v); if (0 < count($v)) { $data['forename'] = implode(' ', $v); } } if (0 != strncmp('customer', $k, 8)) { continue; } $key = substr($k, 8); $data[$key] = $v; } return $data; } /** * Get Source If Any * * Return xid of source and set namespace, if any * * @param WBEvent * @param $namespace * @return string */ protected function getSource(WBEvent $e, &$namespace = '') { $namespace = 'ticket'; return $e->get('id', 0); } }