Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4.0072 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 6 | public function makeField(string $tableName, array $field) |
|
24 | { |
||
25 | /** @var MigrationsGeneratorSetting $setting */ |
||
26 | 6 | $setting = app(MigrationsGeneratorSetting::class); |
|
27 | |||
28 | 6 | switch ($setting->getPlatform()) { |
|
29 | 2 | case Platform::POSTGRESQL: |
|
30 | 6 | $columnType = $this->pgsqlRepository->getTypeByColumnName($tableName, $field['field']); |
|
31 | 6 | if ($columnType !== null) { |
|
32 | 6 | $type = strtolower($columnType); |
|
33 | 6 | $type = preg_replace('/\s+/', '', $type); |
|
34 | |||
35 | 6 | if (isset(PgSQLGeography::MAP[$type])) { |
|
36 | 6 | $field['type'] = PgSQLGeography::MAP[$type]; |
|
37 | } |
||
38 | } |
||
39 | 6 | break; |
|
40 | default: |
||
41 | } |
||
42 | 6 | return $field; |
|
43 | } |
||
45 |