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