Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
96.15% |
25 / 26 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
BoundedContextFactory | |
96.15% |
25 / 26 |
|
75.00% |
3 / 4 |
4 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
createHashmap | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
createHashmapWithMultipleContexts | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |||
createExample | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\Fixtures; |
3 | |
4 | use Apie\Core\BoundedContext\BoundedContext; |
5 | use Apie\Core\BoundedContext\BoundedContextHashmap; |
6 | use Apie\Core\BoundedContext\BoundedContextId; |
7 | use Apie\Core\Lists\ReflectionClassList; |
8 | use Apie\Core\Lists\ReflectionMethodList; |
9 | use Apie\Fixtures\Actions\BackgroundProcessExample; |
10 | use Apie\Fixtures\Actions\StaticActionExample; |
11 | use Apie\Fixtures\Entities\Order; |
12 | use Apie\Fixtures\Entities\Polymorphic\Animal; |
13 | use Apie\Fixtures\Entities\UserWithAddress; |
14 | use Apie\Fixtures\Entities\UserWithAutoincrementKey; |
15 | use ReflectionClass; |
16 | use ReflectionMethod; |
17 | |
18 | final class BoundedContextFactory |
19 | { |
20 | private function __construct() |
21 | { |
22 | } |
23 | |
24 | public static function createHashmap(): BoundedContextHashmap |
25 | { |
26 | return new BoundedContextHashmap([ |
27 | 'default' => self::createExample(), |
28 | ]); |
29 | } |
30 | |
31 | public static function createHashmapWithMultipleContexts(): BoundedContextHashmap |
32 | { |
33 | return new BoundedContextHashmap([ |
34 | 'default' => self::createExample(), |
35 | 'other' => new BoundedContext( |
36 | new BoundedContextId('other'), |
37 | new ReflectionClassList([ |
38 | new ReflectionClass(UserWithAutoincrementKey::class), |
39 | new ReflectionClass(Animal::class), |
40 | ]), |
41 | new ReflectionMethodList(), |
42 | ) |
43 | ]); |
44 | } |
45 | |
46 | public static function createExample(): BoundedContext |
47 | { |
48 | return new BoundedContext( |
49 | new BoundedContextId('default'), |
50 | new ReflectionClassList([ |
51 | new ReflectionClass(UserWithAddress::class), |
52 | new ReflectionClass(Order::class) |
53 | ]), |
54 | new ReflectionMethodList([ |
55 | new ReflectionMethod(StaticActionExample::class, 'secretCode'), |
56 | new ReflectionMethod(BackgroundProcessExample::class, 'createBackgroundProcess'), |
57 | ]) |
58 | ); |
59 | } |
60 | } |