Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| DtoUtils | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| __construct | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| isDto | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\Core\Utils; |
| 3 | |
| 4 | use Apie\Core\Dto\DtoInterface; |
| 5 | use ReflectionClass; |
| 6 | use ReflectionMethod; |
| 7 | use ReflectionProperty; |
| 8 | use ReflectionType; |
| 9 | |
| 10 | final class DtoUtils |
| 11 | { |
| 12 | /** |
| 13 | * @codeCoverageIgnore |
| 14 | */ |
| 15 | private function __construct() |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * @param string|ReflectionClass<object>|ReflectionProperty|ReflectionType|ReflectionMethod $input |
| 21 | */ |
| 22 | public static function isDto(string|ReflectionClass|ReflectionProperty|ReflectionType|ReflectionMethod $input): bool |
| 23 | { |
| 24 | $class = ConverterUtils::toReflectionClass($input); |
| 25 | return $class->isInstantiable() && $class->implementsInterface(DtoInterface::class); |
| 26 | } |
| 27 | } |