Conditions | 1 |
Paths | 1 |
Total Lines | 8 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | protected function addJs(string $file, array $data) |
||
34 | { |
||
35 | $content = file_get_contents($file); |
||
36 | preg_match('/=\s?((?:\r|\n|.)+(}))/', $content, $matches); |
||
37 | $array = json_decode($matches[1], true); |
||
38 | $array['*'][$data['name']] = $data['js']; |
||
39 | $content = preg_replace('/=\s?((?:\r|\n|.)+(}))/', '= ' . json_encode($array, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), $content); |
||
40 | file_put_contents($file, $content); |
||
41 | } |
||
43 |