Conditions | 5 |
Paths | 6 |
Total Lines | 27 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
28 | 6 | public function getFullyQualifiedClassName(string $fullFilePath) |
|
29 | { |
||
30 | 6 | $content = $this->readFile($fullFilePath); |
|
31 | |||
32 | 6 | if (!preg_match('#class\s+(?P<className>\S+)\s#ims', $content, $m)) { |
|
33 | 3 | return null; |
|
34 | } |
||
35 | |||
36 | 6 | $unqualifiedClassName = $m['className']; |
|
37 | |||
38 | 6 | if (!preg_match('#namespace\s+(?P<namespace>\S+);#ims', $content, $m)) { |
|
39 | 3 | return null; |
|
40 | } |
||
41 | |||
42 | 6 | $namespace = $m['namespace']; |
|
43 | 6 | if ($namespace) |
|
44 | 6 | $namespace = '\\' . $namespace; |
|
45 | |||
46 | |||
47 | 6 | $fqn = $namespace . '\\' . $unqualifiedClassName; |
|
48 | |||
49 | 6 | if (!class_exists($fqn)) { |
|
50 | 3 | $this->evaluateCode($content); |
|
51 | } |
||
52 | |||
53 | 6 | return $fqn; |
|
54 | } |
||
55 | |||
67 | } |