/** * Convenience method to merge if the message has a content areas template. * * @param string $templateBody the template body * @param int $messageId the message id * @param DAO $dao an instance of a DAO intended for unit testing * * @return string|false the generated HTML or false if the message does not have * a content areas template */ public static function mergeIfTemplate($templateBody, $messageId, DAO $dao = null) { if (!$templateBody) { return false; } $tm = new self($templateBody); if (!$tm->isTemplate()) { return false; } if ($dao === null) { $dao = new DAO(new DB()); } $mm = new MessageModel($messageId, $dao); return $tm->merge($mm->messageAreas()); }