Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function UpdateJSONViaCommandLine(string $dir, string $code, string $comment) |
||
27 | { |
||
28 | $location = $dir . '/composer.json'; |
||
29 | $this->mu()->execMe( |
||
30 | $dir, |
||
31 | 'php -r \'' |
||
32 | . '$jsonString = file_get_contents("' . $location . '"); ' |
||
33 | . '$data = json_decode($jsonString, true); ' |
||
34 | . $code |
||
35 | . '$newJsonString = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); ' |
||
36 | . 'file_put_contents("' . $location . '", $newJsonString); ' |
||
37 | . '\'', |
||
38 | $comment . ' --- in ' . $location, |
||
39 | false |
||
40 | ); |
||
43 |