dbm_base_path()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
ccs 0
cts 2
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 url(config('dbm.prefix').'/assets?path='.urlencode($path));
7
    }
8
}
9
10
if (! function_exists('dbm_driver')) {
11
    function dbm_driver()
12
    {
13
        return config('dbm.driver', '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
    {
27
        return rtrim(config('dbm.base_path'), '/') ?? '';
28
    }
29
}
30
31
if (! function_exists('is_json')) {
32
    function is_json($string)
33
    {
34
        return is_string($string) && is_array(json_decode($string, true)) && (json_last_error() == JSON_ERROR_NONE) ? true : false;
35
    }
36
}
37
38
if (! function_exists('save_json')) {
39
    function save_json(array $arr)
40
    {
41
        $jsonArr = [];
42
        $i = 1;
43
        foreach ($arr as $key => $value) {
44
            $jsonArr['key_'.$i++] = $value;
45
        }
46
47
        return json_encode($jsonArr);
48
    }
49
}
50
51
if (! function_exists('retreive_json')) {
52
    function retreive_json(string $str)
53
    {
54
        $jsonData = json_decode($str, true);
55
        $jsonResults = [];
56
57
        foreach ($jsonData as $data) {
58
            $jsonResults[] = $data;
59
        }
60
61
        return $jsonResults;
62
    }
63
}
64