1
|
|
|
<?php |
2
|
|
|
namespace PSB\Core\Pipeline; |
3
|
|
|
|
4
|
|
|
|
5
|
|
|
use PSB\Core\Feature\Feature; |
6
|
|
|
use PSB\Core\MessageHandlerRegistry; |
7
|
|
|
use PSB\Core\ObjectBuilder\BuilderInterface; |
8
|
|
|
use PSB\Core\Pipeline\Incoming\IncomingContextFactory; |
9
|
|
|
use PSB\Core\Pipeline\Incoming\InvokeHandlerTerminator; |
10
|
|
|
use PSB\Core\Pipeline\Incoming\LoadHandlersConnector; |
11
|
|
|
use PSB\Core\Util\Settings; |
12
|
|
|
|
13
|
|
View Code Duplication |
class IncomingPipelineFeature 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( |
35
|
|
|
Settings $settings, |
36
|
|
|
BuilderInterface $builder, |
37
|
|
|
PipelineModifications $pipelineModifications |
38
|
|
|
) { |
39
|
1 |
|
$pipelineModifications->registerStep( |
40
|
1 |
|
'LoadHandlersConnector', |
41
|
1 |
|
LoadHandlersConnector::class, |
42
|
|
|
function () use ($builder) { |
43
|
|
|
return new LoadHandlersConnector( |
44
|
|
|
$builder->build(MessageHandlerRegistry::class), |
45
|
|
|
$builder->build(IncomingContextFactory::class) |
46
|
|
|
); |
47
|
1 |
|
} |
48
|
|
|
); |
49
|
1 |
|
$pipelineModifications->registerStep( |
50
|
1 |
|
'InvokeHandlerTerminator', |
51
|
1 |
|
InvokeHandlerTerminator::class, |
52
|
|
|
function () use ($builder) { |
53
|
|
|
return new InvokeHandlerTerminator(); |
54
|
1 |
|
} |
55
|
|
|
); |
56
|
1 |
|
} |
57
|
|
|
} |
58
|
|
|
|