NumberIntervalPoint   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 35
ccs 8
cts 9
cp 0.8889
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A value() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
/**
4
 * GpsLab component.
5
 *
6
 * @author    Peter Gribanov <[email protected]>
7
 * @copyright Copyright (c) 2016, Peter Gribanov
8
 * @license   http://opensource.org/licenses/MIT
9
 */
10
11
namespace GpsLab\Component\Interval\Number;
12
13
use GpsLab\Component\Interval\Exception\InvalidPointTypeException;
14
use GpsLab\Component\Interval\BaseIntervalPoint;
15
16
class NumberIntervalPoint extends BaseIntervalPoint
17
{
18
    /**
19
     * @var float|int
20
     */
21
    private $number;
22
23
    /**
24
     * @param int|float $number
25
     */
26 31
    public function __construct($number)
27
    {
28 31
        if (!is_numeric($number)) {
29
            throw InvalidPointTypeException::type('int|float', $number);
30
        }
31
32 31
        $this->number = $number;
33 31
    }
34
35
    /**
36
     * @return float|int
37
     */
38 31
    public function value()
39
    {
40 31
        return $this->number;
41
    }
42
43
    /**
44
     * @return string
45
     */
46 1
    public function __toString()
47
    {
48 1
        return (string) $this->value();
49
    }
50
}
51