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
|
|
|
* The message meta model class |
18
|
|
|
* |
19
|
|
|
* @author Michiel Boeckaert <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
abstract class MessageMeta implements MessageMetaInterface |
|
|
|
|
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* The participant from the message meta |
25
|
|
|
* |
26
|
|
|
* @var ParticipantInterface |
27
|
|
|
*/ |
28
|
|
|
protected $participant; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* The read status of the message for the given participant |
32
|
|
|
* |
33
|
|
|
* @var integer |
34
|
|
|
*/ |
35
|
|
|
protected $readStatus; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* The previous read status this will return null if the read status has not changed or an integer of the read |
39
|
|
|
* status has changed. |
40
|
|
|
* |
41
|
|
|
* @var integer|null |
42
|
|
|
*/ |
43
|
|
|
protected $previousReadStatus; |
44
|
|
|
|
45
|
|
|
protected $message; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* {@inheritdoc} |
49
|
|
|
*/ |
50
|
|
|
public function setParticipant(ParticipantInterface $participant) |
51
|
|
|
{ |
52
|
|
|
$this->participant = $participant; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* {@inheritdoc} |
57
|
|
|
*/ |
58
|
|
|
public function getParticipant() |
59
|
|
|
{ |
60
|
|
|
return $this->participant; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* {@inheritdoc} |
65
|
|
|
*/ |
66
|
|
|
public function setReadStatus(ReadStatus $readStatus) |
67
|
|
|
{ |
68
|
|
|
$this->previousReadStatus = $this->readStatus; |
69
|
|
|
$this->readStatus = $readStatus->getReadStatus(); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* {@inheritdoc} |
74
|
|
|
*/ |
75
|
|
|
public function getReadStatus() |
76
|
|
|
{ |
77
|
|
|
return $this->readStatus; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* {@inheritdoc} |
82
|
|
|
*/ |
83
|
|
|
public function setMessage(MessageInterface $message) |
84
|
|
|
{ |
85
|
|
|
$this->message = $message; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* {@inheritdoc} |
90
|
|
|
*/ |
91
|
|
|
public function getMessage() |
92
|
|
|
{ |
93
|
|
|
return $this->message; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* {@inheritdoc} |
98
|
|
|
*/ |
99
|
|
|
public function getPreviousReadStatus() |
100
|
|
|
{ |
101
|
|
|
return $this->previousReadStatus; |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.