| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | public function parse(string $identifier): array |
||
| 29 | { |
||
| 30 | $matches = []; |
||
| 31 | $identifiers = []; |
||
| 32 | $num = preg_match_all('/(\w+)=(?<=\w=)(.+?)(?=;\w+=)|(\w+)=([^;]+);?$/', $identifier, $matches, PREG_SET_ORDER); |
||
| 33 | |||
| 34 | foreach ($matches as $i => $match) { |
||
| 35 | if ($i === $num - 1) { |
||
| 36 | $identifiers[$match[3]] = $match[4]; |
||
| 37 | } else { |
||
| 38 | $identifiers[$match[1]] = $match[2]; |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | return $identifiers; |
||
| 43 | } |
||
| 45 |