Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | protected function saveFile( |
||
13 | ConsoleLogger $logger, |
||
14 | OutputInterface $output, |
||
15 | string $destination, |
||
16 | string $data, |
||
17 | ?string $prefix = null, |
||
18 | bool $log = true |
||
19 | ): int { |
||
20 | $result = file_put_contents($destination, $data); |
||
21 | if (false === $result) { |
||
22 | $logger->critical($prefix . 'Unable to save file to ' . $destination); |
||
23 | return Command::FAILURE; |
||
24 | } |
||
25 | if ($log) { |
||
26 | $logger->info($prefix . 'Done!'); |
||
27 | return Command::SUCCESS; |
||
28 | } |
||
29 | $output->writeln($prefix . 'Done!'); |
||
30 | return Command::SUCCESS; |
||
31 | } |
||
33 | } |