| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | 6 | public function getEnumPresetValues(string $table, string $columnName): ?string |
|
| 15 | { |
||
| 16 | /** @var MigrationsGeneratorSetting $setting */ |
||
| 17 | 6 | $setting = app(MigrationsGeneratorSetting::class); |
|
| 18 | |||
| 19 | 6 | $column = $setting->getConnection()->select("SHOW COLUMNS FROM `${table}` where Field = '${columnName}' AND Type LIKE 'enum(%'"); |
|
| 20 | 6 | if (count($column) > 0) { |
|
| 21 | 3 | return substr( |
|
| 22 | 3 | str_replace('enum(', '[', $this->spaceAfterComma($column[0]->Type)), |
|
| 23 | 3 | 0, |
|
| 24 | 3 | -1 |
|
| 25 | 3 | ).']'; |
|
| 26 | } |
||
| 27 | 3 | return null; |
|
| 28 | } |
||
| 52 |