Completed
Push — master ( 0995af...18e83b )
by Rob
01:54
created

BaseOptions   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 79
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B getOptions() 0 70 2
A yaml_loaded() 0 4 1
1
<?php
2
3
namespace devtoolboxuk\cerberus;
4
5
class BaseOptions
6
{
7
8 4
    function getOptions()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getOptions.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
9
    {
10 4
        if ($this->yaml_loaded()) {
11
            return yaml_parse_file(__DIR__ . '/Options.yml');
12
        } else {
0 ignored issues
show
Coding Style introduced by
The method getOptions uses an else expression. Else is never necessary and you can simplify the code to work without else.
Loading history...
Coding Style introduced by
Blank line found at start of control structure
Loading history...
13
14
            return [
15 4
                'Detection' => [
16
                    'Rules' => [
17
                        'Bots' => [
18
                            'active' => 1,
19
                            'score' => 1,
20
                            'params' => 'sensu'
21
                        ],
22
                        'Html' => [
23
                            'active' => 1,
24
                            'score' => 1,
25
                            'params' => '',
26
                        ],
27
                        'Numeric' => [
28
                            'active' => 1,
29
                            'score' => 1,
30
                            'params' => '',
31
                        ],
32
                        'Url' => [
33
                            'active' => 1,
34
                            'score' => 1,
35
                            'params' => '',
36
                        ],
37
                        'DisposableEmail' => [
38
                            'active' => 1,
39
                            'score' => 10,
40
                            'params' => '',
41
                        ],
42
                        'InvalidEmail' => [
43
                            'active' => 1,
44
                            'score' => 1,
45
                            'params' => '',
46
                        ],
47
                        'QueryStringKey' => [
48
                            'active' => 1,
49
                            'score' => 1,
50
                            'params' => '',
51
                        ],
52
                        'QueryStringValue' => [
53
                            'active' => 1,
54
                            'score' => 1,
55
                            'params' => '',
56
                        ],
57
                        'DifferentCountry' => [
58
                            'active' => 1,
59
                            'score' => 10,
60
                            'params' => '',
61
                        ],
62
                        'Country' => [
63
                            'active' => 1,
64
                            'score' => 10,
65
                            'params' => '',
66
                        ],
67
                        'Xss' => [
68
                            'active' => 1,
69
                            'score' => 10,
70
                            'params' => '',
71
                        ]
72
                    ]
73
                ]
74
75
            ];
76
        }
77
    }
78
79 4
    private function yaml_loaded()
0 ignored issues
show
Coding Style Naming introduced by
The method yaml_loaded is not named in camelCase.

This check marks method names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
Coding Style introduced by
Method name "BaseOptions::yaml_loaded" is not in camel caps format
Loading history...
80
    {
81 4
        return extension_loaded('yaml');
82
    }
83
}