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

SoteriaModel   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 53.85%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 47
ccs 7
cts 13
cp 0.5385
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getInput() 0 4 1
A getResult() 0 4 1
A getOutput() 0 4 1
A isValid() 0 4 1
1
<?php
2
3
namespace devtoolboxuk\soteria\models;
4
5
class SoteriaModel
6
{
7
    private $input = '';
8
    private $output = '';
9
    private $passed = true;
10
11
12 1
    function __construct($input, $output, $passed = 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 $passed, 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...
13
    {
14 1
        $this->input = $input;
15 1
        $this->output = $output;
16 1
        $this->passed = $passed;
17 1
    }
18
19
    /**
20
     * @return string
21
     */
22
    public function getInput()
23
    {
24
        return $this->input;
25
    }
26
27
    /**
28
     * @return mixed
29
     */
30
    public function getResult()
31
    {
32
        return $this->getOutput();
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getOutput()
39
    {
40
        return $this->output;
41
    }
42
43
    /**
44
     * @return bool
45
     */
46 1
    public function isValid()
47
    {
48 1
        return $this->passed;
49
    }
50
51
}