Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
14 / 14 |
|
88.89% |
8 / 9 |
|
25.00% |
2 / 8 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| ParameterInfo | |
100.00% |
14 / 14 |
|
88.89% |
8 / 9 |
|
25.00% |
2 / 8 |
|
100.00% |
1 / 1 |
10.75 | |
100.00% |
1 / 1 |
| info | |
100.00% |
14 / 14 |
|
88.89% |
8 / 9 |
|
25.00% |
2 / 8 |
|
100.00% |
1 / 1 |
10.75 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celemas\Wire; |
| 6 | |
| 7 | use ReflectionMethod; |
| 8 | use ReflectionParameter; |
| 9 | |
| 10 | final class ParameterInfo |
| 11 | { |
| 12 | public static function info(ReflectionParameter $param): string |
| 13 | { |
| 14 | $type = $param->getType(); |
| 15 | $rfn = $param->getDeclaringFunction(); |
| 16 | $rcls = null; |
| 17 | |
| 18 | if ($rfn instanceof ReflectionMethod) { |
| 19 | $rcls = $rfn->getDeclaringClass(); |
| 20 | } |
| 21 | |
| 22 | return ( |
| 23 | ($rcls ? $rcls->getName() . '::' : '') |
| 24 | . $rfn->getName() |
| 25 | . '(..., ' |
| 26 | . ($type ? (string) $type . ' ' : '') |
| 27 | . '$' |
| 28 | . $param->getName() |
| 29 | . ', ...)' |
| 30 | ); |
| 31 | } |
| 32 | } |