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