| Conditions | 2 |
| Paths | 2 |
| Total Lines | 9 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | protected function writeFile($path, array $data) |
||
| 41 | { |
||
| 42 | $path = $this->buildOutputPath($path); |
||
| 43 | if (!file_exists(dirname($path))) { |
||
| 44 | mkdir(dirname($path), 0777, true); |
||
| 45 | } |
||
| 46 | $array = str_replace("'" . self::BASE_DIR_SAMPLE, '$baseDir . \'', Helper::exportVar($data)); |
||
| 47 | file_put_contents($path, "<?php\n\n\$baseDir = dirname(dirname(dirname(__DIR__)));\n\nreturn $array;\n"); |
||
| 48 | } |
||
| 49 | |||
| 51 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: