Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
DtoUtils
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
1 / 1
 __construct
n/a
0 / 0
n/a
0 / 0
1
 isDto
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2namespace Apie\Core\Utils;
3
4use Apie\Core\Dto\DtoInterface;
5use ReflectionClass;
6use ReflectionMethod;
7use ReflectionProperty;
8use ReflectionType;
9
10final 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}