Conditions | 7 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 7.0368 |
Changes | 0 |
1 | <?php |
||
52 | 4 | public function getInformationDump(?int $userId = null): InformationWrapper |
|
53 | { |
||
54 | 4 | $result = new InformationWrapper(); |
|
55 | |||
56 | 4 | foreach ($this->messages as $message) { |
|
57 | 4 | if ($message->isEmpty()) { |
|
58 | continue; |
||
59 | } |
||
60 | |||
61 | if ( |
||
62 | 4 | $userId === null |
|
63 | 1 | || $message->getSenderId() === $userId |
|
64 | 1 | || $message->getRecipientId() === null |
|
65 | 4 | || $message->getRecipientId() === $userId |
|
66 | ) { |
||
67 | 4 | $result->addInformationArray($message->getMessage()); |
|
68 | } |
||
69 | } |
||
70 | |||
71 | 4 | return $result; |
|
72 | } |
||
74 |