| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function parse(ContextInterface $context, Cursor $cursor): bool { |
||
| 16 | $previousState = $cursor->saveState(); |
||
| 17 | |||
| 18 | $alert = $cursor->match('/^!{3}([a-z]+)/'); |
||
| 19 | if($alert === null) { |
||
| 20 | $cursor->restoreState($previousState); |
||
| 21 | return false; |
||
| 22 | } |
||
| 23 | |||
| 24 | $type = substr($alert, 3); |
||
| 25 | |||
| 26 | $context->addBlock(new AlertBlock($type)); |
||
| 27 | |||
| 28 | return true; |
||
| 29 | } |
||
| 30 | } |