Backtrace::getViewOrigin()   A
last analyzed

Complexity

Conditions 5
Paths 4

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 5.2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 14
ccs 4
cts 5
cp 0.8
rs 9.6111
cc 5
nc 4
nop 0
crap 5.2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Nip\View\Utilities;
6
7
/**
8
 * Class Backtrace.
9
 */
10
class Backtrace
11
{
12
    /**
13
     * @return string
14 4
     */
15
    public static function getViewOrigin()
16 4
    {
17 4
        $backtrace = debug_backtrace();
18 4
        foreach ($backtrace as $trace) {
19 4
            if ('load' == $trace['function']) {
20
                return $trace['file'];
21
            }
22
23
            if ('__call' == $trace['function'] && 'load' == $trace['args'][0]) {
24
                return $trace['file'];
25
            }
26
        }
27
28
        return null;
29
    }
30
}
31