Test Failed
Push — master ( b6687a...d5e75a )
by Julien
06:32
created

DBHelpers::setFKCheckOn()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 8
nc 3
nop 0
1
<?php
2
3
namespace Xoco70\LaravelTournaments;
4
5
use Illuminate\Support\Facades\DB;
6
7
class DBHelpers
8
{
9
10
11
    static function setFKCheckOff()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
12
    {
13
        switch (DB::getDriverName()) {
14
            case 'mysql':
15
                DB::statement('SET FOREIGN_KEY_CHECKS=0');
16
                break;
17
            case 'sqlite':
18
                DB::statement('PRAGMA foreign_keys = OFF');
19
                break;
20
        }
21
    }
22
23
    static function setFKCheckOn()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
24
    {
25
        switch (DB::getDriverName()) {
26
            case 'mysql':
27
                DB::statement('SET FOREIGN_KEY_CHECKS=1');
28
                break;
29
            case 'sqlite':
30
                DB::statement('PRAGMA foreign_keys = ON');
31
                break;
32
        }
33
    }
34
}