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