Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
FromReflection | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
supports | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
create | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\StorageMetadata\ClassInstantiators; |
3 | |
4 | use Apie\StorageMetadata\Interfaces\ClassInstantiatorInterface; |
5 | use Apie\StorageMetadata\Interfaces\StorageDtoInterface; |
6 | use ReflectionClass; |
7 | |
8 | final class FromReflection implements ClassInstantiatorInterface |
9 | { |
10 | public function supports(ReflectionClass $class, ?StorageDtoInterface $storageObject = null): bool |
11 | { |
12 | return $class->isInstantiable(); |
13 | } |
14 | |
15 | public function create(ReflectionClass $class, ?StorageDtoInterface $storageObject = null): object |
16 | { |
17 | return $class->newInstanceWithoutConstructor(); |
18 | } |
19 | } |