| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 27 | public static function make(string $name): Grammar |
|
| 22 | { |
||
| 23 | 27 | switch ($name) { |
|
| 24 | 27 | case 'mysql': |
|
| 25 | 13 | return new MySqlGrammar(); |
|
| 26 | break; |
||
|
|
|||
| 27 | 14 | case 'postgresql': |
|
| 28 | 1 | case 'pg_sql': |
|
| 29 | 13 | return new PostgresGrammar(); |
|
| 30 | break; |
||
| 31 | } |
||
| 32 | |||
| 33 | 1 | throw new \InvalidArgumentException(\sprintf('%s is not a supported grammar.', $name)); |
|
| 34 | } |
||
| 36 |
The
breakstatement is not necessary if it is preceded for example by areturnstatement:If you would like to keep this construct to be consistent with other
casestatements, you can safely mark this issue as a false-positive.