Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 13 |
Ratio | 100 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
37 | 9 | public function isValid($value) |
|
38 | { |
||
39 | 9 | $result = $this->fetchResult($value); |
|
40 | |||
41 | // A filled array or an object both pass this test causing the error to be set. An empty array or a null value |
||
42 | // will cause the if check to return false. Meaning no error will be set. |
||
43 | 9 | if ($result) { |
|
44 | 3 | $this->error(self::ERROR_OBJECT_FOUND, $value); |
|
45 | 3 | return false; |
|
46 | } |
||
47 | |||
48 | 6 | return true; |
|
49 | } |
||
50 | } |
||
51 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.