Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
27 / 27 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
PersistenceLayerFactory | |
100.00% |
27 / 27 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
create | |
100.00% |
27 / 27 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\DoctrineEntityConverter\Factories; |
3 | |
4 | use Apie\Core\BoundedContext\BoundedContextHashmap; |
5 | use Apie\DoctrineEntityConverter\CodeGenerators\AddDoctrineFields; |
6 | use Apie\DoctrineEntityConverter\CodeGenerators\AddSecondLevelCache; |
7 | use Apie\DoctrineEntityConverter\CodeGenerators\LimitFieldLength; |
8 | use Apie\StorageMetadataBuilder\ChainedBootGeneratedCode; |
9 | use Apie\StorageMetadataBuilder\ChainedGeneratedCodeContext; |
10 | use Apie\StorageMetadataBuilder\ChainedPostGeneratedCodeContext; |
11 | use Apie\StorageMetadataBuilder\CodeGenerators\AccessControlListGenerator; |
12 | use Apie\StorageMetadataBuilder\CodeGenerators\AddAutoIdGenerator; |
13 | use Apie\StorageMetadataBuilder\CodeGenerators\AddIndexesCodeGenerator; |
14 | use Apie\StorageMetadataBuilder\CodeGenerators\FileTableGenerator; |
15 | use Apie\StorageMetadataBuilder\CodeGenerators\ItemListCodeGenerator; |
16 | use Apie\StorageMetadataBuilder\CodeGenerators\RootObjectCodeGenerator; |
17 | use Apie\StorageMetadataBuilder\CodeGenerators\SimplePropertiesCodeGenerator; |
18 | use Apie\StorageMetadataBuilder\CodeGenerators\SubObjectCodeGenerator; |
19 | use Apie\StorageMetadataBuilder\Mediators\GeneratedCode; |
20 | use Apie\StorageMetadataBuilder\StorageMetadataBuilder; |
21 | |
22 | final class PersistenceLayerFactory |
23 | { |
24 | public function create(BoundedContextHashmap $boundedContextHashmap, bool $singleIndexTable = true): GeneratedCode |
25 | { |
26 | $simple = new SimplePropertiesCodeGenerator(); |
27 | $indexer = new AddIndexesCodeGenerator($singleIndexTable); |
28 | $acl = new AccessControlListGenerator(); |
29 | $testItem = new StorageMetadataBuilder( |
30 | $boundedContextHashmap, |
31 | new ChainedBootGeneratedCode( |
32 | $simple, |
33 | $indexer, |
34 | $acl, |
35 | ), |
36 | new ChainedGeneratedCodeContext( |
37 | new AddAutoIdGenerator(), |
38 | new FileTableGenerator(), |
39 | new SubObjectCodeGenerator(), |
40 | new ItemListCodeGenerator(), |
41 | $simple, |
42 | new RootObjectCodeGenerator() |
43 | ), |
44 | new ChainedPostGeneratedCodeContext( |
45 | $indexer, |
46 | $acl, |
47 | new AddDoctrineFields(), |
48 | new LimitFieldLength(), |
49 | new AddSecondLevelCache(), |
50 | ) |
51 | ); |
52 | return $testItem->generateCode(); |
53 | } |
54 | } |