Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | protected function createGrammarFromConnection(Connection $connection): Grammar |
||
23 | { |
||
24 | $queryGrammar = $connection->getQueryGrammar(); |
||
25 | |||
26 | if (!in_array( |
||
27 | get_class($queryGrammar), |
||
28 | [IlluminateMySqlGrammar::class, IlluminateSQLiteGrammar::class] |
||
29 | )) { |
||
30 | throw new Exception("spatie/laravel-binary-uuid only supports MySql or SQLite connections. The current connection doesn't match those criteria."); |
||
31 | } |
||
32 | |||
33 | if ($queryGrammar instanceof IlluminateSQLiteGrammar) { |
||
34 | return new SQLiteGrammar(); |
||
35 | } |
||
36 | |||
37 | return new MySqlGrammar(); |
||
38 | } |
||
39 | } |
||
40 |