DecimalFormatter::format()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
namespace Paranoia\Formatter;
3
4
use Paranoia\Exception\InvalidArgumentException;
5
6
class DecimalFormatter implements FormatterInterface
7
{
8
    public function format($input)
9
    {
10
        if (!is_numeric($input)) {
11
            throw new InvalidArgumentException('The input value must be numeric.');
12
        }
13
14
        return number_format($input, 2, '.', '');
15
    }
16
}
17