QueueCreatorFeatureInstallTask   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 31
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A install() 0 7 3
1
<?php
2
namespace PSB\Core\Transport;
3
4
5
use PSB\Core\Feature\FeatureInstallTaskInterface;
6
use PSB\Core\KnownSettingsEnum;
7
use PSB\Core\Util\Settings;
8
9
class QueueCreatorFeatureInstallTask implements FeatureInstallTaskInterface
10
{
11
    /**
12
     * @var QueueCreatorInterface
13
     */
14
    private $queueCreator;
15
16
    /**
17
     * @var Settings
18
     */
19
    private $settings;
20
21
    /**
22
     * @param QueueCreatorInterface $queueCreator
23
     * @param Settings              $settings
24
     */
25 4
    public function __construct(QueueCreatorInterface $queueCreator, Settings $settings)
26
    {
27
28 4
        $this->queueCreator = $queueCreator;
29 4
        $this->settings = $settings;
30 4
    }
31
32 3
    public function install()
33
    {
34 3
        $createQueues = $this->settings->tryGet(KnownSettingsEnum::CREATE_QUEUES);
35 3
        if ($createQueues || $createQueues === null) {
36 2
            $this->queueCreator->createIfNecessary($this->settings->get(QueueBindings::class));
37
        }
38 3
    }
39
}
40