public function getNewMessagesForConversation($conversationId, $lastMessageTimestamp = null) { if (($conversation = $this->getConversation($conversationId)) === null) { return array(); } if (empty($lastMessageTimestamp)) { $lastMessageTimestamp = time(); } $result = array(); $messageList = $this->messageDao->findConversationMessagesByLastMessageTimestamp($conversation->id, $lastMessageTimestamp); foreach ($messageList as $message) { $result[] = $this->getMessageDataForApi($message); } return $result; }