|
1
|
|
|
<?php |
|
2
|
|
|
namespace PSB\Core\MessageMutation; |
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
use PSB\Core\Feature\Feature; |
|
6
|
|
|
use PSB\Core\MessageMutation\Pipeline\Incoming\IncomingLogicalMessageMutationPipelineStep; |
|
7
|
|
|
use PSB\Core\MessageMutation\Pipeline\Incoming\IncomingPhysicalMessageMutationPipelineStep; |
|
8
|
|
|
use PSB\Core\MessageMutatorRegistry; |
|
9
|
|
|
use PSB\Core\ObjectBuilder\BuilderInterface; |
|
10
|
|
|
use PSB\Core\Pipeline\Incoming\IncomingLogicalMessageFactory; |
|
11
|
|
|
use PSB\Core\Pipeline\PipelineModifications; |
|
12
|
|
|
use PSB\Core\Util\Settings; |
|
13
|
|
|
|
|
14
|
|
View Code Duplication |
class IncomingMessageMutationFeature extends Feature |
|
15
|
|
|
{ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Method will always be executed and should be used to determine whether to enable or disable the feature, |
|
19
|
|
|
* configure default settings, configure dependencies, configure prerequisites and register startup tasks. |
|
20
|
|
|
*/ |
|
21
|
1 |
|
public function describe() |
|
22
|
|
|
{ |
|
23
|
1 |
|
$this->enableByDefault(); |
|
24
|
1 |
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Method is called if all defined conditions are met and the feature is marked as enabled. |
|
28
|
|
|
* Use this method to configure and initialize all required components for the feature like |
|
29
|
|
|
* the steps in the pipeline or the instances/factories in the container. |
|
30
|
|
|
* |
|
31
|
|
|
* @param Settings $settings |
|
32
|
|
|
* @param BuilderInterface $builder |
|
33
|
|
|
* @param PipelineModifications $pipelineModifications |
|
34
|
|
|
*/ |
|
35
|
1 |
|
public function setup(Settings $settings, BuilderInterface $builder, PipelineModifications $pipelineModifications) |
|
36
|
|
|
{ |
|
37
|
1 |
|
$pipelineModifications->registerStep( |
|
38
|
1 |
|
'IncomingLogicalMessageMutation', |
|
39
|
1 |
|
IncomingLogicalMessageMutationPipelineStep::class, |
|
40
|
1 |
|
function () use ($builder) { |
|
41
|
|
|
return new IncomingLogicalMessageMutationPipelineStep( |
|
42
|
|
|
$builder->build(MessageMutatorRegistry::class), |
|
43
|
|
|
$builder->build(IncomingLogicalMessageFactory::class) |
|
44
|
|
|
); |
|
45
|
1 |
|
} |
|
46
|
|
|
); |
|
47
|
|
|
|
|
48
|
1 |
|
$pipelineModifications->registerStep( |
|
49
|
1 |
|
'IncomingPhysicalMessageMutation', |
|
50
|
1 |
|
IncomingPhysicalMessageMutationPipelineStep::class, |
|
51
|
1 |
|
function () use ($builder) { |
|
52
|
|
|
return new IncomingPhysicalMessageMutationPipelineStep($builder->build(MessageMutatorRegistry::class)); |
|
53
|
1 |
|
} |
|
54
|
|
|
); |
|
55
|
1 |
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|