TransportFeature   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 45.45%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 36
ccs 5
cts 11
cp 0.4545
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A describe() 0 14 1
A setup() 0 4 1
1
<?php
2
namespace PSB\Core\Transport;
3
4
5
use PSB\Core\Feature\Feature;
6
use PSB\Core\KnownSettingsEnum;
7
use PSB\Core\ObjectBuilder\BuilderInterface;
8
use PSB\Core\Pipeline\PipelineModifications;
9
use PSB\Core\Transport\Config\TransportInfrastructure;
10
use PSB\Core\Util\Settings;
11
12
class TransportFeature extends Feature
13
{
14
15
    /**
16
     * Method will always be executed and should be used to determine whether to enable or disable the feature,
17
     * configure default settings, configure dependencies, configure prerequisites and register startup tasks.
18
     */
19 1
    public function describe()
20
    {
21 1
        $this->enableByDefault();
22 1
        $this->registerDefault(
23
            function (Settings $settings) {
24
                /** @var TransportInfrastructure $transportInfrastructure */
25
                $transportInfrastructure = $settings->get(TransportInfrastructure::class);
26
                $settings->setDefault(
27
                    KnownSettingsEnum::LOCAL_ADDRESS,
28
                    $transportInfrastructure->toTransportAddress($settings->get(KnownSettingsEnum::ENDPOINT_NAME))
29
                );
30 1
            }
31
        );
32 1
    }
33
34
    /**
35
     * Method is called if all defined conditions are met and the feature is marked as enabled.
36
     * Use this method to configure and initialize all required components for the feature like
37
     * the steps in the pipeline or the instances/factories in the container.
38
     *
39
     * @param Settings              $settings
40
     * @param BuilderInterface      $builder
41
     * @param PipelineModifications $pipelineModifications
42
     */
43
    public function setup(Settings $settings, BuilderInterface $builder, PipelineModifications $pipelineModifications)
44
    {
45
46
    }
47
}
48