DecimalFormatter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 9
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A format() 0 7 2
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