Completed
Push — master ( 6a6c7b...f57853 )
by Sebastian
03:30
created

Min   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 100 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 35
loc 35
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A test() 7 7 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/**
4
 * Linna Filter
5
 *
6
 * @author Sebastian Rapetti <[email protected]>
7
 * @copyright (c) 2017, Sebastian Rapetti
8
 * @license http://opensource.org/licenses/MIT MIT License
9
 */
10
declare(strict_types = 1);
11
12
namespace Linna\Filter\Rules;
13
14
use Linna\Filter\RuleInterface;
15
16
/**
17
 * Check if value is below a minum.
18
 */
19 View Code Duplication
class Min implements RuleInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
20
{
21
    /**
22
     * @var mixed Received value.
23
     */
24
    private $received;
25
    
26
    /**
27
     * @var mixed Min expected value.
28
     */
29
    private $min;
30
31
    /**
32
     *
33
     * @param mixed $received
34
     * @param mixed $min
35
     */
36
    public function __construct($received, $min)
37
    {
38
        $this->received = $received;
39
        $this->min = $min;
40
    }
41
42
    /**
43
     * Test.
44
     *
45
     * @return bool
46
     */
47
    public function test(): bool
48
    {
49
        if ($this->received < $this->min) {
50
            return true;
51
        }
52
53
        return false;
54
    }
55
}
56