| Conditions | 1 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | public function exportToFile(string $template, string $destination): void |
||
| 39 | 2 | { |
|
| 40 | 2 | $data = $this->exportToArray() + [ |
|
| 41 | 'generatedAt' => time(), |
||
| 42 | 'rootPackageName' => $this->getEvent()->getComposer()->getPackage()->getName(), |
||
| 43 | ]; |
||
| 44 | |||
| 45 | $installPathTmp = sprintf( |
||
| 46 | '%s_%s', |
||
| 47 | $destination, |
||
| 48 | uniqid('tmp', true) |
||
| 49 | ); |
||
| 50 | 2 | ||
| 51 | file_put_contents( |
||
| 52 | 2 | $installPathTmp, |
|
| 53 | 2 | $this->twig->render( |
|
| 54 | 2 | $template, |
|
| 55 | $data |
||
| 56 | ) |
||
| 57 | 2 | ); |
|
| 58 | 2 | chmod($installPathTmp, 0664); |
|
| 59 | 2 | rename($installPathTmp, $destination); |
|
| 60 | 2 | } |
|
| 67 |