DecimalValue::getValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * User: delboy1978uk
4
 * Date: 13/11/2016
5
 * Time: 13:26
6
 */
7
8
namespace Del\Common\Value;
9
10
use InvalidArgumentException;
11
12
class DecimalValue extends AbstractValue
13
{
14
    /**
15
     * IntValue constructor.
16
     *
17
     * @param float $value
18
     */
19 2
    public function __construct($value)
20
    {
21 2
        if(!is_numeric($value)) {
22 1
            throw new InvalidArgumentException('Please supply a numeric value');
23
        }
24 2
        $this->value = (float) number_format((float) $value, 2,'.','');
25 2
    }
26
27
    /**
28
     * @return float
29
     */
30 1
    public function getValue()
31
    {
32 1
        return parent::getValue();
33
    }
34
}