Conditions | 1 |
Paths | 1 |
Total Lines | 41 |
Code Lines | 37 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
63 | return array_map(static function ($match) { |
||
64 | $result = [ |
||
65 | 'class' => (string)$match['CLASS'], |
||
66 | 'type' => $match['TYPE'], |
||
67 | 'function' => $match['FUNCTION'], |
||
68 | ]; |
||
69 | if ($match['FILE'] !== null) { |
||
70 | $result['file'] = $match['FILE']; |
||
71 | } |
||
72 | if ($match['LINE'] !== null) { |
||
73 | $result['line'] = (int)$match['LINE']; |
||
74 | } |
||
75 | return $result; |
||
76 | }, $matches); |
||
77 | } |
||
78 | |||
79 | protected function runRegexp(string $pattern, string $source, array &$matches): array |
||
80 | { |
||
81 | if (!preg_match_all($pattern, $source, $matches, PREG_SET_ORDER | PREG_UNMATCHED_AS_NULL)) { |
||
82 | throw new RuntimeException( |
||
83 | 'Parse error' |
||
84 | ); |
||
85 | } |
||
86 | return $matches; |
||
87 | } |
||
88 | } |