Conditions | 3 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public static function createInstance(string $table, array $schema): self |
||
20 | { |
||
21 | //Schema is basically array of index columns merged with index meta |
||
22 | $index = new self($table, current($schema)['indexName']); |
||
23 | $index->type = current($schema)['isUnique'] ? self::UNIQUE : self::NORMAL; |
||
24 | |||
25 | foreach ($schema as $indexColumn) { |
||
26 | $index->columns[] = $indexColumn['columnName']; |
||
27 | } |
||
28 | |||
29 | return $index; |
||
30 | } |
||
31 | } |