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

ReflectionFunctionAbstractName::__invoke()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 1
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