Passed
Push — master ( 4248bd...b32226 )
by Chris
02:25
created

IntToStringFormatter::formatData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 6
rs 10
1
<?php
2
3
namespace WebTheory\Saveyour\Formatters;
4
5
use WebTheory\Saveyour\Contracts\DataFormatterInterface;
6
7
class IntToStringFormatter implements DataFormatterInterface
8
{
9
    /**
10
     *
11
     */
12
    public function formatData($value)
13
    {
14
        return is_array($value) ? array_map('strval', $value) : (string) $value;
15
    }
16
17
    /**
18
     *
19
     */
20
    public function formatInput($value)
21
    {
22
        return is_array($value) ? array_map('intval', $value) : (int) $value;
23
    }
24
}
25