Passed
Push — master ( 43cce1...1a30b3 )
by Fran
02:56
created

debug()   C

Complexity

Conditions 12
Paths 16

Size

Total Lines 24
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 156

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 12
eloc 20
c 1
b 0
f 0
nc 16
nop 3
dl 0
loc 24
ccs 0
cts 18
cp 0
crap 156
rs 6.9666

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
use PSFS\base\extension\CustomTranslateExtension;
4
use Symfony\Component\Finder\Finder;
5
6
//Cargamos en memoria la función de desarrollo PRE
7
if (!function_exists('pre')) {
8
    /**
9
     * @param mixed $var
10
     * @param boolean $die
11
     * @return void
12
     */
13
    function pre(mixed $var, bool $die = false): void
14
    {
15 1
        $html = '<pre style="padding:10px;margin:0;display:block;background: #EEE; box-shadow: inset 0 0 3px 3px #DDD; color: #666; text-shadow: 1px 1px 1px #CCC;border-radius: 5px;">';
16 1
        $html .= is_null($var) ? '<b>NULL</b>' : print_r($var, TRUE);
17 1
        $html .= '</pre>';
18 1
        echo $html;
19 1
        if ($die) {
20
            die;
21
        }
22
    }
23
}
24
25
if (!function_exists("getallheaders")) {
26
    function getallheaders(): array
27
    {
28 2
        $headers = [];
29 2
        foreach ($_SERVER as $h => $v) {
30 2
            if (preg_match('/HTTP_(.+)/', $h, $hp)) {
31
                $headers[$hp[1]] = $v;
32
            }
33
        }
34 2
        return $headers;
35
    }
36
}
37
38
if (file_exists(CORE_DIR)) {
39
    $loaded_files = [];
40
    //Autoload de módulos
41
    $finder = new Finder();
42
    $finder->files()->in(CORE_DIR)->name('autoload.php');
43
    /* @var $file SplFileInfo */
44
    foreach ($finder as $file) {
45
        $path = $file->getRealPath();
46
        if (!in_array($path, $loaded_files)) {
47
            $loaded_files[] = $path;
48
            require_once($path);
49
        }
50
    }
51
}
52
53
if (!function_exists('t')) {
54
    function t($message, $key = null, $reload = false)
55
    {
56 10
        return CustomTranslateExtension::_($message, $key, $reload);
57
    }
58
}
59