Failed Conditions
Pull Request — master (#6)
by Tibor
01:51
created

Config   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 50
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A shouldSkipScenarios() 0 4 1
A shouldSkipFeatures() 0 4 1
A getSkipTags() 0 4 1
1
<?php
2
3
namespace Bex\Behat\SkipTestsExtension\ServiceContainer;
4
5
class Config
6
{
7
    const CONFIG_PARAM_SKIP_SCENARIOS = 'skip_scenarios';
8
    const CONFIG_PARAM_SKIP_FEATURES = 'skip_features';
9
    const CONFIG_PARAM_SKIP_TAGS = 'skip_tags';
10
11
    /**
12
     * @var bool
13
     */
14
    private $skipScenarios;
15
16
    /**
17
     * @var string[]
18
     */
19
    private $skipTags = [];
20
21
    /**
22
     * @param array $config
23
     */
24
    public function __construct($config)
25
    {
26
        $this->skipScenarios = $config[self::CONFIG_PARAM_SKIP_SCENARIOS];
27
        $this->skipFeatures = $config[self::CONFIG_PARAM_SKIP_FEATURES];
0 ignored issues
show
Bug introduced by
The property skipFeatures does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
28
        $this->skipTags = $config[self::CONFIG_PARAM_SKIP_TAGS];
29
    }
30
31
    /**
32
     * @return bool
33
     */
34
    public function shouldSkipScenarios()
35
    {
36
        return $this->skipScenarios;
37
    }
38
39
    /**
40
     * @return bool
41
     */
42
    public function shouldSkipFeatures()
43
    {
44
        return $this->skipFeatures;
45
    }
46
47
    /**
48
     * @return string[]
49
     */
50
    public function getSkipTags()
51
    {
52
        return $this->skipTags;
53
    }
54
}
55