Completed
Push — 0.3 ( 50717a...cd8a4f )
by jean
10s
created

ConfigurationStep   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 42
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A __construct() 0 6 1
A getChildren() 0 3 1
A getService() 0 3 1
A getOptions() 0 3 1
A isEnabled() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: darkilliant
5
 * Date: 5/8/18
6
 * Time: 11:04 AM.
7
 */
8
9
namespace Darkilliant\ProcessBundle\Configuration;
10
11
class ConfigurationStep
12
{
13
    private $next;
0 ignored issues
show
introduced by
The private property $next is not used, and could be removed.
Loading history...
14
15
    private $options;
16
17
    private $service;
18
19
    /** @var bool */
20
    private $enabled;
21
22 9
    private function __construct(string $service, array $options, array $children, bool $enabled = true)
23
    {
24 9
        $this->service = $service;
25 9
        $this->options = $options;
26 9
        $this->children = array_map([ConfigurationStep::class, 'create'], $children);
0 ignored issues
show
Bug Best Practice introduced by
The property children does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
27 9
        $this->enabled = $enabled;
28 9
    }
29
30 9
    public static function create(array $config)
31
    {
32 9
        return new self($config['service'], $config['options'] ?? [], $config['children'] ?? [], $config['enabled'] ?? true);
33
    }
34
35 7
    public function getOptions(): array
36
    {
37 7
        return $this->options;
38
    }
39
40 7
    public function getService(): string
41
    {
42 7
        return $this->service;
43
    }
44
45 4
    public function getChildren(): array
46
    {
47 4
        return $this->children;
48
    }
49
50 7
    public function isEnabled()
51
    {
52 7
        return $this->enabled;
53
    }
54
}
55