FeatureStartupTaskController::start()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
namespace PSB\Core\Feature;
3
4
5
use PSB\Core\BusContextInterface;
6
use PSB\Core\ObjectBuilder\BuilderInterface;
7
8
class FeatureStartupTaskController
9
{
10
    /**
11
     * @var callable
12
     */
13
    private $taskFactory;
14
15
    /**
16
     * @param callable $taskFactory
17
     */
18 3
    public function __construct(callable $taskFactory)
19
    {
20 3
        $this->taskFactory = $taskFactory;
21 3
    }
22
23
    /**
24
     * @param BuilderInterface    $builder
25
     * @param BusContextInterface $busContext
26
     */
27 2
    public function start(BuilderInterface $builder, BusContextInterface $busContext)
28
    {
29 2
        $taskFactory = $this->taskFactory;
30
        /** @var FeatureStartupTaskInterface $startupTask */
31 2
        $startupTask = $taskFactory($builder);
32 2
        $startupTask->start($busContext);
33 2
    }
34
}
35