| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function parse(string $comment): Annotations |
||
| 14 | { |
||
| 15 | $lines = explode("\n", $comment); |
||
| 16 | $lines = array_map(function (string $line) { |
||
| 17 | return trim($line, " \r\t"); |
||
| 18 | }, $lines); |
||
| 19 | |||
| 20 | $annotations = []; |
||
| 21 | |||
| 22 | // Is the line an annotation? Let's test this with a regexp. |
||
| 23 | foreach ($lines as $line) { |
||
| 24 | if (preg_match("/^[@][a-zA-Z]/", $line) === 1) { |
||
| 25 | $annotations[] = $this->parseAnnotation($line); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | return new Annotations($annotations); |
||
| 30 | } |
||
| 31 | |||
| 48 |