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

IntToStringFormatter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 16
ccs 0
cts 7
cp 0
rs 10
wmc 4

2 Methods

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