Conditions | 7 |
Paths | 18 |
Total Lines | 39 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function write(array $hints) |
||
18 | { |
||
19 | $config = []; |
||
20 | |||
21 | foreach ($hints as $tableName => $tableHints) { |
||
22 | foreach ($tableHints as $columnName => $hint) { |
||
23 | /** @var ConfigGuesserHint $hint */ |
||
24 | $c = [ |
||
25 | 'generator' => 'faker', |
||
26 | 'formatter' => $hint->formatter, |
||
27 | ]; |
||
28 | |||
29 | if (null !== $hint->arguments) { |
||
30 | $c['arguments'] = $hint->arguments; |
||
31 | } |
||
32 | |||
33 | if (null !== $hint->locale) { |
||
34 | $c['locale'] = $hint->locale; |
||
35 | } |
||
36 | |||
37 | if (null !== $hint->unique) { |
||
38 | $c['unique'] = $hint->unique; |
||
39 | } |
||
40 | |||
41 | if (null !== $hint->date) { |
||
42 | $c['date_format'] = 'Y-m-d H:i:s'; |
||
43 | } |
||
44 | |||
45 | $config[$tableName]['fields'][$columnName] = $c; |
||
46 | } |
||
47 | } |
||
48 | |||
49 | $config = [ |
||
50 | 'webnet_fr_database_anonymizer' => [ |
||
51 | 'tables' => $config, |
||
52 | ], |
||
53 | ]; |
||
54 | |||
55 | return Yaml::dump($config, 6); |
||
56 | } |
||
58 |