Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
FromReflection
100.00% covered (success)
100.00%
2 / 2
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%
1 / 1
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\StorageDtoInterface;
6use ReflectionClass;
7
8final 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}