| 1 | <?php |
||
| 8 | class Messages extends Element |
||
| 9 | { |
||
| 10 | protected $selector = '#messages'; |
||
| 11 | |||
| 12 | public function getMessageText($type) |
||
| 13 | { |
||
| 14 | $alerts = $this->findAll('css', sprintf('.alert-%s', $type)); |
||
| 15 | if (count($alerts) < 1) { |
||
| 16 | throw new Exception(sprintf("Unable to find any alert with type '%s'", $type)); |
||
| 17 | } |
||
| 18 | |||
| 19 | return implode("\n", array_map(function ($alert) { |
||
| 20 | return $alert->getText(); |
||
| 21 | }, $alerts)); |
||
| 22 | } |
||
| 23 | } |
||
| 24 |