| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 47 | 66 | protected function createIndexName($type, array $columns) |
|
| 48 | { |
||
| 49 | $short_type = [ |
||
| 50 | 66 | 'primary' => 'pk', |
|
| 51 | 66 | 'foreign' => 'fk', |
|
| 52 | 66 | 'unique' => 'uk', |
|
| 53 | 66 | ]; |
|
| 54 | |||
| 55 | 66 | $type = isset($short_type[$type]) ? $short_type[$type] : $type; |
|
| 56 | |||
| 57 | 66 | $index = strtolower($this->prefix . $this->table . '_' . implode('_', $columns) . '_' . $type); |
|
| 58 | |||
| 59 | // max index name length is 30 chars |
||
| 60 | 66 | return substr(str_replace(['-', '.'], '_', $index), 0, 30); |
|
| 61 | } |
||
| 62 | |||
| 75 |