Completed
Push — master ( 901cc6...ad6830 )
by James
15s queued 11s
created

ReflectionFunctionAbstractName   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roave\ApiCompare\Formatter;
6
7
use Roave\BetterReflection\Reflection\ReflectionFunctionAbstract;
8
use Roave\BetterReflection\Reflection\ReflectionMethod;
9
10
final class ReflectionFunctionAbstractName
11
{
12
    public function __invoke(ReflectionFunctionAbstract $function) : string
13
    {
14
        if ($function instanceof ReflectionMethod) {
15
            if ($function->isStatic()) {
16
                return $function->getDeclaringClass()->getName() . '::' . $function->getName() . '()';
17
            }
18
19
            return $function->getDeclaringClass()->getName() . '#' . $function->getName() . '()';
20
        }
21
22
        return $function->getName() . '()';
23
    }
24
}
25