| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 22 | * @param string $filename Output filename without extension |
||
| 23 | * @param string $fileExtension File extension. Default is '.dat' |
||
| 24 | * |
||
| 25 | * @see Generate::generateRandomNumbers() |
||
| 26 | */ |
||
| 27 | public static function saveStringToFile($string, $filename, $fileExtension = '.dat') |
||
| 28 | { |
||
| 29 | // Create dir if not exists |
||
| 30 | if (!is_dir(dirname($filename))) { |
||
| 31 | Text::debug('Creating missing directory: '.dirname($filename)); |
||
| 32 | mkdir(dirname($filename)); |
||
| 33 | } |
||
| 34 | |||
| 35 | // Warn about overwriting file |
||
| 36 | if (file_exists($filename.$fileExtension)) { |
||
| 37 | Text::message('File '.$filename.$fileExtension.' exists and it will be overwritten!'); |
||
| 38 | Input::dieOnDenyUserConfirm(); |
||
| 39 | } |
||
| 40 | |||
| 41 | Text::message('Saving to file...'); |
||
| 48 |