1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the MilioooMessageBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Michiel boeckaert <[email protected]> |
7
|
|
|
* This source file is subject to the MIT license that is bundled |
8
|
|
|
* with this source code in the file LICENSE. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Miliooo\Messaging\Model; |
12
|
|
|
|
13
|
|
|
use Miliooo\Messaging\User\ParticipantInterface; |
14
|
|
|
use Miliooo\Messaging\ValueObjects\ReadStatus; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Interface for the message meta |
18
|
|
|
* |
19
|
|
|
* @author Michiel Boeckaert <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
interface MessageMetaInterface extends BuilderInterface |
22
|
|
|
{ |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* The participant has never read the message |
26
|
|
|
*/ |
27
|
|
|
const READ_STATUS_NEVER_READ = 0; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The participant has read the message but marked it as unread |
31
|
|
|
*/ |
32
|
|
|
const READ_STATUS_MARKED_UNREAD = 1; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* The participant has read the message |
36
|
|
|
*/ |
37
|
|
|
const READ_STATUS_READ = 2; |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Sets the participant to the message meta |
42
|
|
|
* |
43
|
|
|
* @param ParticipantInterface $participant The participant we add to the meta |
44
|
|
|
*/ |
45
|
|
|
public function setParticipant(ParticipantInterface $participant); |
|
|
|
|
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Gets the participant from the meta |
49
|
|
|
* |
50
|
|
|
* @return ParticipantInterface The participant from the meta |
51
|
|
|
*/ |
52
|
|
|
public function getParticipant(); |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Sets the read status of the message for the given participant. |
56
|
|
|
* |
57
|
|
|
* @param ReadStatus $readStatus |
58
|
|
|
*/ |
59
|
|
|
public function setReadStatus(ReadStatus $readStatus); |
|
|
|
|
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Gets the read status of the message for the participant of this meta |
63
|
|
|
* |
64
|
|
|
* @return integer one of the read statuses constants |
65
|
|
|
*/ |
66
|
|
|
public function getReadStatus(); |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Sets the message this message meta belongs to |
70
|
|
|
* |
71
|
|
|
* @param MessageInterface $message The message this meta belongs to |
72
|
|
|
*/ |
73
|
|
|
public function setMessage(MessageInterface $message); |
|
|
|
|
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Gets the message |
77
|
|
|
* |
78
|
|
|
* @return MessageInterface The message this meta belongs to |
79
|
|
|
*/ |
80
|
|
|
public function getMessage(); |
81
|
|
|
|
82
|
|
|
|
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Gets the previous read status of a message. |
86
|
|
|
* |
87
|
|
|
* Since we update the read status before we display the messages to the user we need to check the previous read |
88
|
|
|
* status to see if a message is a new read or not |
89
|
|
|
* |
90
|
|
|
* @return $boolean |
|
|
|
|
91
|
|
|
*/ |
92
|
|
|
public function getPreviousReadStatus(); |
93
|
|
|
} |
94
|
|
|
|
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.