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

Min::test()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 7
loc 7
ccs 0
cts 6
cp 0
crap 6
rs 9.4285
c 0
b 0
f 0
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