Passed
Push — master ( 84df0a...6b36a1 )
by Julien
05:09
created

helpers.php ➔ setFKCheckOff()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 8

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
eloc 8
nc 3
nop 0
dl 11
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use Illuminate\Support\Facades\DB;
4
5 View Code Duplication
function setFKCheckOff()
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
    switch (DB::getDriverName()) {
8
        case 'mysql':
9
            DB::statement('SET FOREIGN_KEY_CHECKS=0');
10
            break;
11
        case 'sqlite':
12
            DB::statement('PRAGMA foreign_keys = OFF');
13
            break;
14
    }
15
}
16
17 View Code Duplication
function setFKCheckOn()
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
{
19
    switch (DB::getDriverName()) {
20
        case 'mysql':
21
            DB::statement('SET FOREIGN_KEY_CHECKS=1');
22
            break;
23
        case 'sqlite':
24
            DB::statement('PRAGMA foreign_keys = ON');
25
            break;
26
    }
27
}