Test Failed
Push — v0.1 ( 3df3e6...629e1b )
by Hennik
13:04 queued 08:54
created

GrammarFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 21
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 13 4
1
<?php
2
3
namespace LaravelSpatial\Schema\Grammars;
4
5
use Illuminate\Database\Schema\Grammars\Grammar;
6
7
/**
8
 * Class GrammarFactory
9
 *
10
 * @package LaravelSpatial\Schema\Grammars
11
 * @internal
12
 */
13
class GrammarFactory
14
{
15
16
    /**
17
     * @param string $name
18
     *
19
     * @return \Illuminate\Database\Schema\Grammars\Grammar
20
     */
21
    public static function make(string $name): Grammar
22
    {
23
        switch ($name) {
24
            case 'mysql':
25
                return new MySqlGrammar();
26
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
27
            case 'postgresql':
28
            case 'pg_sql':
29
                return new PostgresGrammar();
30
                break;
31
        }
32
33
        throw new \InvalidArgumentException(\sprintf('%s is not a supported grammar.', $name));
34
    }
35
}
36