10 public const TAG =
'MESSAGESERVICE';
13 private static $canUse;
17 if (static::$canUse ===
null)
19 static::$canUse = Loader::includeModule(
'pull');
21 return static::$canUse;
26 if (!static::canUse())
31 return static::addToStack(
34 'messages' => static::convertData($messages)
44 private static function addToStack($command, array $params)
46 if (!static::canUse())
51 return \CPullWatch::addToStack(
54 'module_id' =>
'messageservice',
55 'command' => $command,
67 private static function convertData(array $messages): array
69 foreach($messages as $k => $message)
71 foreach ($message as $field => $value)
73 if ($value instanceof DateTime)
75 $messages[$k][$field] = (string)$value;