ConfigurationStep::getService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Darkilliant\ProcessBundle\Configuration;
6
7
class ConfigurationStep
8
{
9
    /** @var array */
10
    private $children;
11
12
    /** @var array */
13
    private $options;
14
15
    /** @var string */
16
    private $service;
17
18
    /** @var bool */
19
    private $enabled;
20
21 10
    private function __construct(string $service, array $options, array $children, bool $enabled = true)
22
    {
23 10
        $this->service = $service;
24 10
        $this->options = $options;
25 10
        $this->children = array_map([ConfigurationStep::class, 'create'], $children);
26 10
        $this->enabled = $enabled;
27 10
    }
28
29 10
    public static function create(array $config)
30
    {
31 10
        return new self($config['service'], $config['options'] ?? [], $config['children'] ?? [], $config['enabled'] ?? true);
32
    }
33
34 8
    public function getOptions(): array
35
    {
36 8
        return $this->options;
37
    }
38
39 8
    public function getService(): string
40
    {
41 8
        return $this->service;
42
    }
43
44 5
    public function getChildren(): array
45
    {
46 5
        return $this->children;
47
    }
48
49 8
    public function isEnabled()
50
    {
51 8
        return $this->enabled;
52
    }
53
}
54