1 | <?php |
||
21 | abstract class Thread implements ThreadInterface |
||
|
|||
22 | { |
||
23 | /** |
||
24 | * The unique id of the thread |
||
25 | * |
||
26 | * @var integer |
||
27 | */ |
||
28 | protected $id; |
||
29 | |||
30 | /** |
||
31 | * The subject of the thread |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $subject; |
||
36 | |||
37 | /** |
||
38 | * The participant who created the thread |
||
39 | * |
||
40 | * @var ParticipantInterface |
||
41 | */ |
||
42 | protected $createdBy; |
||
43 | |||
44 | /** |
||
45 | * The datetime when the thread was created |
||
46 | * |
||
47 | * @var \DateTime |
||
48 | */ |
||
49 | protected $createdAt; |
||
50 | |||
51 | /** |
||
52 | * An array collection of messages for this thread |
||
53 | * |
||
54 | * @var ArrayCollection|MessageInterface[] |
||
55 | */ |
||
56 | protected $messages; |
||
57 | |||
58 | /** |
||
59 | * An array collection of thread metas for this thread |
||
60 | * |
||
61 | * @var ArrayCollection|ThreadMeta[] |
||
62 | */ |
||
63 | protected $threadMeta; |
||
64 | |||
65 | /** |
||
66 | * An array collection with participants |
||
67 | * |
||
68 | * @var ArrayCollection |
||
69 | */ |
||
70 | protected $participants; |
||
71 | |||
72 | /** |
||
73 | * The last message posted in this thread. |
||
74 | * |
||
75 | * @var MessageInterface |
||
76 | */ |
||
77 | protected $lastMessage; |
||
78 | |||
79 | /** |
||
80 | * Constructor. |
||
81 | */ |
||
82 | public function __construct() |
||
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | public function getId() |
||
96 | |||
97 | /** |
||
98 | * {@inheritdoc} |
||
99 | */ |
||
100 | public function setSubject($subject) |
||
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | public function getSubject() |
||
112 | |||
113 | /** |
||
114 | * {@inheritdoc} |
||
115 | */ |
||
116 | public function setCreatedBy(ParticipantInterface $participant) |
||
120 | |||
121 | /** |
||
122 | * {@inheritdoc} |
||
123 | */ |
||
124 | public function getCreatedBy() |
||
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | public function setCreatedAt(\DateTime $createdAt) |
||
136 | |||
137 | /** |
||
138 | * {@inheritdoc} |
||
139 | */ |
||
140 | public function getCreatedAt() |
||
144 | |||
145 | /** |
||
146 | * {@inheritdoc} |
||
147 | */ |
||
148 | public function addMessage(MessageInterface $message) |
||
153 | |||
154 | /** |
||
155 | * {@inheritdoc} |
||
156 | */ |
||
157 | public function getMessages() |
||
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | */ |
||
165 | public function getFirstMessage() |
||
169 | |||
170 | /** |
||
171 | * {@inheritdoc} |
||
172 | */ |
||
173 | public function getLastMessage() |
||
177 | |||
178 | /** |
||
179 | * {@inheritdoc} |
||
180 | */ |
||
181 | public function setLastMessage(MessageInterface $message) |
||
185 | |||
186 | /** |
||
187 | * {@inheritdoc} |
||
188 | */ |
||
189 | public function getThreadMeta() |
||
193 | |||
194 | /** |
||
195 | * {@inheritdoc} |
||
196 | */ |
||
197 | public function addThreadMeta(ThreadMetaInterface $threadMeta) |
||
202 | |||
203 | /** |
||
204 | * {@inheritdoc} |
||
205 | */ |
||
206 | public function getThreadMetaForParticipant(ParticipantInterface $participant) |
||
216 | |||
217 | /** |
||
218 | * {@inheritdoc} |
||
219 | */ |
||
220 | public function getParticipants() |
||
224 | |||
225 | /** |
||
226 | * {@inheritdoc} |
||
227 | */ |
||
228 | public function isParticipant(ParticipantInterface $participant) |
||
232 | |||
233 | /** |
||
234 | * Returns an array collection of participants for the given thread. |
||
235 | * |
||
236 | * We do not map the participantscollection because the thread meta allready |
||
237 | * gives us all the information needed. It contains the thread AND the participant |
||
238 | * |
||
239 | * So in order to get the participants we need to loop over the threadmeta |
||
240 | * Get the participant and add it to the collection. |
||
241 | * |
||
242 | * if we want to add a participant to the thread collection we need to create that threadmeta. |
||
243 | * |
||
244 | * @return ArrayCollection |
||
245 | */ |
||
246 | protected function getParticipantsCollection() |
||
266 | |||
267 | /** |
||
268 | * {@inheritdoc} |
||
269 | */ |
||
270 | public function getOtherParticipants(ParticipantInterface $participant) |
||
281 | |||
282 | /** |
||
283 | * Adds a participant form the thread meta |
||
284 | * |
||
285 | * @param ThreadMetaInterface $threadMeta The threadmeta we extract the participant from |
||
286 | * |
||
287 | * @throws \InvalidArgumentException if participant is not instance of participantinterface |
||
288 | */ |
||
289 | protected function addParticipantFromThreadMeta(ThreadMetaInterface $threadMeta) |
||
304 | } |
||
305 |
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.