function __construct($id = null, $color = null) { $this->result['ID'] = $id ? $id : time(); $this->result['BLOCKS'] = array(); if ($color != self::CHAT) { if (!$color || !preg_match('/#([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\\b/', $color)) { $color = Bitrix\Im\Color::getRandomColor(); } $this->result['COLOR'] = $color; } }