1 | <?php |
||
27 | class MessagingExtension extends \Twig_Extension |
||
28 | { |
||
29 | /** |
||
30 | * A participant provider instance. |
||
31 | * |
||
32 | * @var ParticipantProviderInterface |
||
33 | */ |
||
34 | protected $participantProvider; |
||
35 | |||
36 | /** |
||
37 | * An unread messages provider instance. |
||
38 | * |
||
39 | * @var UnreadMessagesProviderInterface |
||
40 | */ |
||
41 | protected $unreadMessagesProvider; |
||
42 | |||
43 | |||
44 | public function __construct( |
||
51 | |||
52 | /** |
||
53 | * Returns a list of functions to add to the existing list. |
||
54 | * |
||
55 | * @return array An array of functions |
||
56 | */ |
||
57 | public function getFunctions() |
||
65 | |||
66 | /** |
||
67 | * Checks if the message needs a new read label. |
||
68 | * |
||
69 | * @param MessageInterface $message |
||
70 | * |
||
71 | * @return boolean true if it's a new read message for the logged in user |
||
72 | * false if no message meta found for the logged in user |
||
73 | * or not a new read message for the logged in user |
||
74 | */ |
||
75 | public function isMessageNewRead(MessageInterface $message) |
||
96 | |||
97 | /** |
||
98 | * Checks how many unread messages a thread has for the logged in participant |
||
99 | * |
||
100 | * @param ThreadInterface $thread The thread we check |
||
101 | * |
||
102 | * @return integer The number of unread messages for this thread for the participant |
||
103 | */ |
||
104 | public function getThreadUnreadCount(ThreadInterface $thread) |
||
116 | |||
117 | /** |
||
118 | * Gets the total unread messages count for the logged in user. |
||
119 | * |
||
120 | * @return integer The unread messages count for the logged in user |
||
121 | */ |
||
122 | public function getUnreadMessagesCount() |
||
128 | |||
129 | /** |
||
130 | * Returns the name of the extension. |
||
131 | * |
||
132 | * @return string The extension name |
||
133 | */ |
||
134 | public function getName() |
||
138 | } |
||
139 |