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