Conditions | 1 |
Paths | 1 |
Total Lines | 25 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
35 | 1 | public static function varExportToFile(string $filename, array $values): int |
|
36 | { |
||
37 | $options = [ |
||
38 | 1 | 'array.indent' => 4, |
|
39 | 'array.align' => true, |
||
40 | 'array.omit' => true, |
||
41 | 'array.short' => true, |
||
42 | 'object.format' => 'export', |
||
43 | 'string.utf8' => true, |
||
44 | 'whitespace' => true, |
||
45 | ]; |
||
46 | |||
47 | 1 | $encoder = new PHPEncoder($options); |
|
48 | |||
49 | 1 | $data = '<?php'; |
|
50 | 1 | $data .= PHP_EOL; |
|
51 | 1 | $data .= 'declare(strict_types=1);'; |
|
52 | 1 | $data .= PHP_EOL; |
|
53 | 1 | $data .= PHP_EOL; |
|
54 | 1 | $data .= 'return '; |
|
55 | 1 | $data .= $encoder->encode($values); |
|
56 | 1 | $data .= ';'; |
|
57 | 1 | $data .= PHP_EOL; |
|
58 | |||
59 | 1 | return (int) file_put_contents($filename, $data); |
|
60 | } |
||
62 |