| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function actionPrepare() |
||
| 18 | { |
||
| 19 | $dir = dirname(__DIR__, 2); |
||
| 20 | $src = "$dir/res/units-tree.yml"; |
||
| 21 | $tree = Yaml::parse(file_get_contents($src)); |
||
| 22 | $this->prepareUnits('', $tree); |
||
| 23 | $dump = var_export($this->units, true); |
||
| 24 | |||
| 25 | $dst = "$dir/res/units-tree.php"; |
||
| 26 | $old = file_get_contents($dst); |
||
| 27 | $new = "<?php\n\nreturn $dump;\n"; |
||
| 28 | if ($old !== $new) { |
||
| 29 | echo "Written units-tree.php\n"; |
||
| 30 | file_put_contents($dst, $new); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 58 |