| Conditions | 1 |
| Paths | 1 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | 77 | public function createIndexName($type, array $columns, array $options = [], string $table = null): string |
|
| 15 | { |
||
| 16 | 77 | $nameParts = []; |
|
| 17 | 77 | $nameParts[] = $this->prefix . ($table ?? $this->table); |
|
| 18 | 77 | $nameParts = array_merge($nameParts, $this->getColumnNames($columns)); |
|
| 19 | 77 | $nameParts[] = $type; |
|
| 20 | 77 | $nameParts = array_merge($nameParts, array_keys($options)); |
|
| 21 | 77 | array_filter($nameParts); |
|
| 22 | |||
| 23 | 77 | $index = strtolower(implode('_', $nameParts)); |
|
| 24 | 77 | $index = preg_replace("/\[\*+\]+/", '_array', $index); |
|
| 25 | |||
| 26 | 77 | return preg_replace('/[^A-Za-z0-9]+/', '_', $index); |
|
| 27 | } |
||
| 44 |