Passed
Push — master ( a53302...e71c1f )
by Alexander
06:09 queued 03:53
created

d()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 4
c 1
b 0
f 1
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
use Yiisoft\VarDumper\VarDumper;
6
7
if (!function_exists('d')) {
8
    /**
9
     * Prints variables.
10
     *
11
     * @param mixed ...$variables Variables to be dumped.
12
     *
13
     * @see \Yiisoft\VarDumper\VarDumper::dump()
14
     *
15
     * @psalm-suppress MixedAssignment
16
     */
17
    function d(...$variables): void
18
    {
19 2
        $highlight = PHP_SAPI !== 'cli';
20
21 2
        foreach ($variables as $variable) {
22 2
            VarDumper::dump($variable, 10, $highlight);
23 2
            echo $highlight ? '<br>' : PHP_EOL;
24
        }
25
    }
26
}
27
28
if (!function_exists('dd')) {
29
    /**
30
     * Prints variables and terminate the current script.
31
     *
32
     * @param mixed ...$variables Variables to be dumped.
33
     *
34
     * @see \Yiisoft\VarDumper\VarDumper::dump()
35
     *
36
     * @psalm-suppress MixedAssignment
37
     */
38
    function dd(...$variables): void
39
    {
40
        d(...$variables);
41
42
        die(0);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
43
    }
44
}
45