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

DBHelpers   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setFKCheckOff() 0 11 3
A setFKCheckOn() 0 11 3
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
}