| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | public static function tableNotFound($tableName, Schema $schema, \Exception $previousException = null) |
||
| 10 | { |
||
| 11 | $closestTableName = ''; |
||
| 12 | $closestScore = INF; |
||
| 13 | foreach ($schema->getTables() as $testedTable) { |
||
| 14 | $testedTableName = $testedTable->getName(); |
||
| 15 | $l = levenshtein($testedTableName, $tableName); |
||
| 16 | if ($l < $closestScore) { |
||
| 17 | $closestScore = $l; |
||
| 18 | $closestTableName = $testedTableName; |
||
| 19 | } |
||
| 20 | } |
||
| 21 | |||
| 22 | return new self("Could not find table '$tableName'. Did you mean '$closestTableName'?", 0, $previousException); |
||
| 23 | } |
||
| 24 | } |
||
| 25 |