Passed
Push — master ( e7f49b...05f9be )
by Alec
01:39
created

Caller::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AlecRabbit\Accessories;
6
7
class Caller
8
{
9
    /**
10
     * Static class. Private Constructor.
11
     */
12
    // @codeCoverageIgnoreStart
13
    private function __construct()
14
    {
15
    }
16
17
    // @codeCoverageIgnoreEnd
18
19 1
    public static function get(int $depth = 2): string
20
    {
21 1
        $caller = debug_backtrace()[$depth];
22 1
        $type = $caller['type'] ?? '';
23 1
        $function = $caller['function'] . '()';
24
        return
25 1
            isset($caller['class']) ?
26 1
                $caller['class'] . $type . $function :
27 1
                $function;
28
    }
29
}
30