SubscriptionApplierStartupTask::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
namespace PSB\Core\Routing\AutoSubscription;
3
4
5
use PSB\Core\BusContextInterface;
6
use PSB\Core\Feature\FeatureStartupTaskInterface;
7
8
class SubscriptionApplierStartupTask implements FeatureStartupTaskInterface
9
{
10
    /**
11
     * @var string[]
12
     */
13
    private $messageFqcnsHandledByThisEndpoint;
14
15
    /**
16
     * @param string[] $messageFqcnsHandledByThisEndpoint
17
     */
18 3
    public function __construct(array $messageFqcnsHandledByThisEndpoint)
19
    {
20 3
        $this->messageFqcnsHandledByThisEndpoint = $messageFqcnsHandledByThisEndpoint;
21 3
    }
22
23
    /**
24
     * @param BusContextInterface $busContext
25
     */
26 2
    public function start(BusContextInterface $busContext)
27
    {
28 2
        foreach ($this->messageFqcnsHandledByThisEndpoint as $messageFqcn) {
29 1
            $busContext->subscribe($messageFqcn);
30
        }
31 2
    }
32
}
33