MessageCorrelationFeature::setup()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1.0028

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 6
cts 7
cp 0.8571
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1.0028
1
<?php
2
namespace PSB\Core\Correlation;
3
4
5
use PSB\Core\Correlation\Pipeline\AttachCorrelationIdPipelineStep;
6
use PSB\Core\Feature\Feature;
7
use PSB\Core\ObjectBuilder\BuilderInterface;
8
use PSB\Core\Pipeline\PipelineModifications;
9
use PSB\Core\Util\Settings;
10
11
class MessageCorrelationFeature extends Feature
12
{
13
14
    /**
15
     * Method will always be executed and should be used to determine whether to enable or disable the feature,
16
     * configure default settings, configure dependencies, configure prerequisites and register startup tasks.
17
     */
18 1
    public function describe()
19
    {
20 1
        $this->enableByDefault();
21 1
    }
22
23
    /**
24
     * Method is called if all defined conditions are met and the feature is marked as enabled.
25
     * Use this method to configure and initialize all required components for the feature like
26
     * the steps in the pipeline or the instances/factories in the container.
27
     *
28
     * @param Settings              $settings
29
     * @param BuilderInterface      $builder
30
     * @param PipelineModifications $pipelineModifications
31
     */
32 1
    public function setup(
33
        Settings $settings,
34
        BuilderInterface $builder,
35
        PipelineModifications $pipelineModifications
36
    ) {
37 1
        $pipelineModifications->registerStep(
38 1
            'AttachCorrelationIdPipelineStep',
39 1
            AttachCorrelationIdPipelineStep::class,
40
            function () {
41
                return new AttachCorrelationIdPipelineStep();
42 1
            }
43
        );
44 1
    }
45
}
46