Completed
Push — master ( eadec5...63be38 )
by CodexShaper
06:14 queued 10s
created

dbm_base_path()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
ccs 0
cts 1
cp 0
crap 2
1
<?php
2
3
if (! function_exists('dbm_asset')) {
4
    function dbm_asset($path, $secure = null)
0 ignored issues
show
Unused Code introduced by
The parameter $secure is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

4
    function dbm_asset($path, /** @scrutinizer ignore-unused */ $secure = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
5
    {
6
        return route('dbm.asset').'?path='.urlencode($path);
7
    }
8
}
9
10
if (! function_exists('dbm_driver')) {
11
    function dbm_driver()
12
    {
13
        return (config('database.default') != '') ? config('database.default') : 'mysql';
14
    }
15
}
16
17
if (! function_exists('dbm_prefix')) {
18
    function dbm_prefix()
19
    {
20
        return (config('dbm.prefix') != '') ? config('dbm.prefix') : '';
21
    }
22
}
23
24
if(! function_exists('dbm_base_path')) {
25
    function dbm_base_path(){
26
        return rtrim(config('dbm.base_path'), '/') ?? ''; 
27
    }
28
}
29
30
if (! function_exists('is_json')) {
31
    function is_json($string)
32
    {
33
        return is_string($string) && is_array(json_decode($string, true)) && (json_last_error() == JSON_ERROR_NONE) ? true : false;
34
    }
35
}
36
37
if (! function_exists('save_json')) {
38
    function save_json(array $arr)
39
    {
40
        $jsonArr = [];
41
        $i = 1;
42
        foreach ($arr as $key => $value) {
43
            $jsonArr['key_'.$i++] = $value;
44
        }
45
46
        return json_encode($jsonArr);
47
    }
48
}
49
50
if (! function_exists('retreive_json')) {
51
    function retreive_json(string $str)
52
    {
53
        $jsonData = json_decode($str, true);
54
        $jsonResults = [];
55
56
        foreach ($jsonData as $data) {
57
            $jsonResults[] = $data;
58
        }
59
60
        return $jsonResults;
61
    }
62
}
63