RootLevelFunctionProcessor   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 3
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A shouldProcess() 0 3 3
A process() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jerowork\ClassDependenciesParser\PhpParser\NodeVisitor\InlineFqnParser\Processor;
6
7
use Jerowork\ClassDependenciesParser\Fqn;
8
use Jerowork\ClassDependenciesParser\ClassDependencies;
9
use PhpParser\Node;
10
use PhpParser\Node\Expr\FuncCall;
11
use PhpParser\Node\Name;
12
13
/**
14
 * All non Fully-qualified Name statements with one name part and exists as function.
15
 */
16
final class RootLevelFunctionProcessor implements InlineFqnProcessor
17
{
18 4
    public function shouldProcess(Node $parent, Name $name, ClassDependencies $classDependencies): bool
19
    {
20 4
        return $parent instanceof FuncCall && count($name->parts) === 1 && function_exists((string) $name);
21
    }
22
23 1
    public function process(Node $parent, Name $name, ClassDependencies $classDependencies): ?Fqn
24
    {
25 1
        return new Fqn((string) $name);
26
    }
27
}
28