Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
FromStorage
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 supports
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 create
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\StorageMetadata\ClassInstantiators;
3
4use Apie\StorageMetadata\Interfaces\ClassInstantiatorInterface;
5use Apie\StorageMetadata\Interfaces\StorageClassInstantiatorInterface;
6use Apie\StorageMetadata\Interfaces\StorageDtoInterface;
7use ReflectionClass;
8
9final 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}