| Conditions | 5 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 14 | protected static function getVisibility(\Reflector $reflector): string |
|
| 22 | { |
||
| 23 | if ( |
||
| 24 | 14 | !$reflector instanceof \ReflectionMethod && |
|
| 25 | 14 | !$reflector instanceof \ReflectionProperty |
|
| 26 | ) { |
||
| 27 | 1 | throw new InvalidArgumentException( |
|
| 28 | 1 | sprintf( |
|
| 29 | 1 | 'Reflector must be an instance of "%s" or "%s", "%s" given', |
|
| 30 | 1 | \ReflectionMethod::class, |
|
| 31 | 1 | \ReflectionProperty::class, |
|
| 32 | 1 | get_class($reflector) |
|
| 33 | ) |
||
| 34 | ); |
||
| 35 | } |
||
| 36 | |||
| 37 | 13 | foreach (['Public', 'Protected', 'Private'] as $visibility) { |
|
| 38 | 13 | if ($reflector->{'is' . $visibility}()) { |
|
| 39 | 13 | return strtolower($visibility); |
|
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | 1 | throw new \RuntimeException('Witness me!'); |
|
| 44 | } |
||
| 45 | } |
||
| 46 |