Range::inRange()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 2
eloc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace BestServedCold\PhalueObjects\Mathematical;
4
5
use BestServedCold\PhalueObjects\Format\Csv;
6
use BestServedCold\PhalueObjects\Mathematical;
7
use BestServedCold\PhalueObjects\Variadic;
8
9
/**
10
 * Class Range
11
 *
12
 * @package   BestServedCold\PhalueObjects\Mathematical
13
 * @author    Adam Lewis <[email protected]>
14
 * @copyright Copyright (c) 2015 Best Served Cold Media Limited
15
 * @license   http://http://opensource.org/licenses/GPL-3.0 GPL License
16
 * @link      http://bestservedcold.com
17
 * @since     0.0.1-alpha
18
 * @version   0.0.2-alpha
19
 */
20
class Range extends Variadic
21
{
22
    /**
23
     * @var mixed
24
     */
25
    protected $minimum;
26
27
    /**
28
     * @var mixed
29
     */
30
    protected $maximum;
31
32
    /**
33
     * @param bool $maximum
34
     * @param bool $minimum
35
     */
36 2
    public function __construct($maximum, $minimum)
37
    {
38 2
        $this->maximum = $maximum;
39 2
        $this->minimum = $minimum;
40 2
        parent::__construct($maximum, $minimum);
41 2
    }
42
43
    /**
44
     * @return string
45
     */
46 1
    public function __toString()
47
    {
48 1
        return Csv::fromArray([ $this->maximum, $this->minimum ])->getValue();
49
    }
50
51
    /**
52
     * @param  integer $integer
53
     * @return bool
54
     */
55 1
    public function inRange($integer)
0 ignored issues
show
Coding Style introduced by
function inRange() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
56
    {
57 1
        return ($this->minimum >= $integer) && ($this->maximum <= $integer);
58
    }
59
}
60