Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
21 | private function encodePathElement($pathElement): string |
||
22 | { |
||
23 | if (is_int($pathElement)) { |
||
24 | return "[{$pathElement}]"; |
||
25 | } |
||
26 | |||
27 | if (is_string($pathElement)) { |
||
28 | $escapedElement = str_replace(['\\', '\''], ['\\\\', '\\\''], $pathElement); |
||
29 | |||
30 | return "['{$escapedElement}']"; |
||
31 | } |
||
32 | |||
33 | throw new Exception\InvalidPathElementException($pathElement); |
||
34 | } |
||
36 |