Conditions | 5 |
Paths | 5 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5.0488 |
Changes | 0 |
1 | <?php |
||
27 | 9 | public static function create($function) : \ReflectionFunctionAbstract |
|
28 | { |
||
29 | 9 | if (\is_string($function)) { |
|
30 | 2 | return \strpos($function, '::') ? new \ReflectionMethod($function) : new \ReflectionFunction($function); |
|
31 | } |
||
32 | |||
33 | 7 | if (\is_array($function)) { |
|
34 | 5 | return (new \ReflectionClass(\ReflectionMethod::class))->newInstanceArgs($function); |
|
35 | } |
||
36 | |||
37 | 2 | if (\method_exists($function, '__invoke')) { |
|
38 | 2 | return new \ReflectionMethod($function, '__invoke'); |
|
39 | } |
||
40 | |||
41 | return new \ReflectionFunction($function); |
||
42 | } |
||
43 | } |
||
44 |