Passed
Pull Request — master (#45)
by Evgeniy
01:58
created

dd()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
ccs 0
cts 3
cp 0
crap 6
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
    function d(...$variables)
16
    {
17
        foreach ($variables as $variable) {
18
            VarDumper::dump($variable, 10, PHP_SAPI !== 'cli');
19
        }
20
    }
21
}
22
23
if (!function_exists('dd')) {
24
    /**
25
     * Prints variables and terminate the current script.
26
     *
27
     * @param mixed ...$variables Variables to be dumped.
28
     *
29
     * @see \Yiisoft\VarDumper\VarDumper::dump()
30
     */
31
    function dd(...$variables)
32
    {
33
        foreach ($variables as $variable) {
34
            VarDumper::dump($variable, 10, PHP_SAPI !== 'cli');
35
        }
36
        die();
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...
37
    }
38
}
39