Conditions | 3 |
Paths | 3 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public function setTemplateVariables(GameControllerInterface $game): void |
||
20 | { |
||
21 | $user = $game->getUser(); |
||
22 | $messages = $this->privateMessageRepository->getConversations($user); |
||
23 | $timestamp = $this->stuTime->time(); |
||
24 | |||
25 | $conversations = []; |
||
26 | |||
27 | foreach ($messages as $message) { |
||
28 | $senderId = $message->getSenderId(); |
||
29 | if (!array_key_exists($senderId, $conversations)) { |
||
30 | $conversations[$senderId] = new Conversation( |
||
31 | $message, |
||
32 | $timestamp, |
||
33 | $this->stuTime, |
||
34 | $user->getId(), |
||
35 | $this->privateMessageRepository, |
||
36 | $this->contactRepository |
||
37 | ); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | $game->setTemplateVar('CONVERSATIONS', $conversations); |
||
42 | } |
||
44 |