Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
DatalayerImplementation | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
4 | |
100.00% |
1 / 1 |
toClass | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
4 |
1 | <?php |
2 | namespace Apie\IntegrationTests\Config\Enums; |
3 | |
4 | use Apie\Common\Wrappers\RequestAwareInMemoryDatalayer; |
5 | use Apie\Core\Datalayers\ApieDatalayer; |
6 | use Apie\DoctrineEntityDatalayer\DoctrineEntityDatalayer; |
7 | use Apie\Faker\Datalayers\FakerDatalayer; |
8 | use ReflectionClass; |
9 | |
10 | enum DatalayerImplementation: string |
11 | { |
12 | case DB_DATALAYER = 'db'; |
13 | case IN_MEMORY = 'in_memory'; |
14 | case FAKER = 'faker'; |
15 | |
16 | /** |
17 | * @return ReflectionClass<ApieDatalayer> |
18 | */ |
19 | public function toClass(): ReflectionClass |
20 | { |
21 | return match ($this) { |
22 | self::DB_DATALAYER => new ReflectionClass(DoctrineEntityDatalayer::class), |
23 | self::IN_MEMORY => new ReflectionClass(RequestAwareInMemoryDatalayer::class), |
24 | self::FAKER => new ReflectionClass(FakerDatalayer::class), |
25 | }; |
26 | } |
27 | } |