Completed
Push — master ( d15e2a...9605ab )
by Rob
01:57
created

FilterModel   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 34
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getResult() 0 4 1
A isValid() 0 4 1
1
<?php
2
3
namespace devtoolboxuk\soteria\models;
4
5
class FilterModel
6
{
7
    private $result;
8
    private $valid = true;
9
10
    /**
11
     * FilterModel constructor.
12
     * @param $result
13
     * @param bool $valid
14
     */
15 1
    function __construct($result, $valid = true)
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...
introduced by
The method __construct has a boolean flag argument $valid, which is a certain sign of a Single Responsibility Principle violation.
Loading history...
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for __construct.

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...
16
    {
17 1
        $this->result = $result;
18 1
        $this->valid = $valid;
19 1
    }
20
21
22
    /**
23
     * @return mixed
24
     */
25 1
    public function getResult()
26
    {
27 1
        return $this->result;
28
    }
29
30
    /**
31
     * @return bool
32
     */
33 1
    public function isValid()
34
    {
35 1
        return $this->valid;
36
    }
37
38
}