Passed
Push — add/6 ( 1ceb7c...3ff08f )
by
unknown
09:22 queued 04:37
created

Range   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A includes() 0 3 2
A __construct() 0 4 1
1
<?php
2
/**
3
 * SCSSPHP
4
 *
5
 * @copyright 2015-2018 Leaf Corcoran
6
 *
7
 * @license http://opensource.org/licenses/MIT MIT
8
 *
9
 * @link http://leafo.github.io/scssphp
10
 */
11
12
namespace Leafo\ScssPhp\Base;
13
14
/**
15
 * Range
16
 *
17
 * @author Anthon Pang <[email protected]>
18
 */
19
class Range
20
{
21
    public $first;
22
    public $last;
23
24
    /**
25
     * Initialize range
26
     *
27
     * @param integer|float $first
28
     * @param integer|float $last
29
     */
30
    public function __construct($first, $last)
31
    {
32
        $this->first = $first;
33
        $this->last = $last;
34
    }
35
36
    /**
37
     * Test for inclusion in range
38
     *
39
     * @param integer|float $value
40
     *
41
     * @return boolean
42
     */
43
    public function includes($value)
44
    {
45
        return $value >= $this->first && $value <= $this->last;
46
    }
47
}
48