Conditions | 3 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function buildConfigurationFile(Configuration $configuration, bool $skipDefaults = true): string |
||
28 | { |
||
29 | $configArray = $configuration->getArrayCopy(); |
||
30 | |||
31 | if ($skipDefaults) |
||
32 | { |
||
33 | $nonDefaults = ArrayUtils::recursiveArrayDiff($configArray, (new Configuration())->getArrayCopy()); |
||
34 | |||
35 | $vaultConfigs = []; |
||
36 | foreach ($configuration->getVaults() as $vaultConfiguration) |
||
37 | { |
||
38 | $vaultConfigs[] = ArrayUtils::recursiveArrayDiff($vaultConfiguration->getArrayCopy(), (new VaultConfiguration())->getArrayCopy()); |
||
39 | } |
||
40 | |||
41 | $nonDefaults['vaults'] = $vaultConfigs; |
||
42 | |||
43 | $configArray = $nonDefaults; |
||
44 | } |
||
45 | |||
46 | return json_encode($configArray, JSON_PRETTY_PRINT); |
||
47 | } |
||
48 | } |
||
49 |