Completed
Push — master ( 3a7482...36f3d7 )
by Jim
08:32
created

Helpers.php ➔ timsdk_d()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
use TimSDK\Container\ServiceContainer;
4
use TimSDK\Support\Dumper;
5
6
/**
7
 * Return the default value of the given value.
8
 *
9
 * @param  mixed  $value
10
 * @return mixed
11
 */
12
function timsdk_value($value)
13
{
14
    return $value instanceof \Closure ? $value() : $value;
15
}
16
17
/**
18
 * Get the available container instance.
19
 *
20
 * @param string $abstract
21
 * @return mixed
22
 */
23
function timsdk_app($abstract = null)
24
{
25
    if (is_null($abstract)) {
26
        return ServiceContainer::getInstance();
27
    }
28
29
    return ServiceContainer::getInstance()->offsetGet($abstract);
30
}
31
32
/**
33
 * Dump the passed variables and end the script.
34
 */
35
function timsdk_dd()
36
{
37
    foreach (func_get_args() as $arg) {
38
        (new Dumper)->dump($arg);
39
    }
40
41
    die(1);
0 ignored issues
show
Coding Style Compatibility introduced by
The function timsdk_dd() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
42
}
43
44
function timsdk_d()
45
{
46
    foreach (func_get_args() as $arg) {
47
        (new Dumper)->dump($arg);
48
    }
49
}
50