Conditions | 6 |
Paths | 6 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 6.0163 |
Changes | 0 |
1 | <?php |
||
23 | 10 | public function __construct(Reply $reply) |
|
24 | { |
||
25 | 10 | $messages = $reply->getMessages(); |
|
26 | |||
27 | 10 | if (\count($messages) > 0) { |
|
28 | 10 | $this->greeting = $messages[0]; |
|
29 | |||
30 | 10 | foreach (\array_slice($messages, 1) as $message) { |
|
31 | 10 | $advertisement = \preg_split('/[\s]+/', $message); |
|
32 | 10 | if ($advertisement === false) { |
|
33 | $advertisement = []; |
||
34 | } |
||
35 | |||
36 | 10 | if (\count($advertisement) > 1) { |
|
37 | 9 | foreach (\array_slice($advertisement, 1) as $command) { |
|
38 | 9 | $this->advertisements[$advertisement[0] . ' ' . $command] = true; |
|
39 | } |
||
40 | } else { |
||
41 | 7 | $this->advertisements[$advertisement[0]] = true; |
|
42 | } |
||
43 | } |
||
44 | } |
||
45 | 10 | } |
|
46 | |||
60 |