Passed
Push — master ( e6e7cc...e196d5 )
by Felipe
05:12
created

ddd()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * JPGraph v4.1.0-beta.01
5
 */
6
if (!defined('STDIN')) {
7
    define('STDIN', fopen('php://stdin', 'rb'));
8
}
9
10
if (!defined('STDOUT')) {
11
    define('STDOUT', fopen('php://stdout', 'wb'));
12
}
13
14
if (!defined('STDERR')) {
15
    define('STDERR', fopen('php://stderr', 'wb'));
16
}
17
18
if (!class_exists('\Kint')) {
19
    /**
20
     * Class that mocks Kint
21
     * (will use this when dev dependencies are not installed).
22
     */
23
    class Kint
24
    {
25
        public static $enabled_mode     = true;
26
        public static $aliases          = [];
27
        public static $mode_default_cli = false;
28
        public static function dump()
29
        {
30
        }
31
    }
32
}
33
if (class_exists('\Kint\Renderer\RichRenderer')) {
34
    \Kint\Renderer\RichRenderer::$folder = false;
35
}
36
if (method_exists('\Kint', 'enabled')) {
37
    \Kint::enabled(DEBUGMODE);
38
} elseif (property_exists('\Kint', 'enabled_mode')) {
39
    \Kint::$enabled_mode = Kint::$mode_default_cli;
40
}
41
42
if (!class_exists('\PhpConsole\Handler')) {
43
    /**
44
     * Class that mocks PHP-Console debug feature.
45
     */
46
    class PC
47
    {
48
        public static function debug()
49
        {
50
        }
51
    }
52
}
53
54
if (!function_exists('kdump')) {
55
    function kdump(...$vars)
56
    {
57
        ob_start();
58
59
        d(...$vars);
60
61
        $kintdump = (ob_get_clean());
62
63
        //dump($kintdump);
64
        fwrite(STDERR, $kintdump);
65
    }
66
67
68
69
    \Kint::$aliases[] = 'kdump';
70
}
71
if (
72
    getenv('JPGRAPH_USE_PHPCONSOLE') &&
73
    isset($_SERVER['HTTP_USER_AGENT']) &&
74
    strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false
75
) {
76
    $handler = \PhpConsole\Handler::getInstance();
77
    \PhpConsole\Helper::register();
78
    $handler->start();
79
    \PC::debug('Started');
80
}
81