Conditions | 5 |
Paths | 4 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 5.1374 |
Changes | 0 |
1 | <?php |
||
32 | 30 | public function parse(ContextInterface $context, Cursor $cursor) |
|
33 | { |
||
34 | 30 | if (!in_array($cursor->getNextNonSpaceCharacter(), IconBlock::getIconBlockTypes()) || |
|
35 | 30 | $cursor->getCharacter($cursor->getNextNonSpacePosition() + 1) !== '>') { |
|
36 | 30 | return false; |
|
37 | } |
||
38 | |||
39 | 23 | $type = $cursor->getNextNonSpaceCharacter(); |
|
40 | |||
41 | 23 | $cursor->advanceToNextNonSpaceOrNewline(); |
|
42 | 23 | if ($cursor->peek() === '>') { |
|
43 | 23 | $cursor->advanceBy(2); |
|
44 | 23 | if ($cursor->getCharacter() === ' ') { |
|
45 | 23 | $cursor->advance(); |
|
46 | 23 | } |
|
47 | 23 | } |
|
48 | |||
49 | 23 | $context->addBlock(new IconBlock($type)); |
|
50 | |||
51 | 23 | return true; |
|
52 | } |
||
53 | } |
||
54 |