Passed
Push — master ( 14b05a...fa6902 )
by Daniel
02:41
created

UnderscoreToSpaceFormatter::format()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
/**
4
 * This file is part of the Csv-Machine package.
5
 *
6
 * (c) Dan McAdams <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace RoadBunch\Csv\Formatter;
13
14
15
/**
16
 * Class UnderscoreToSpaceFormatter
17
 *
18
 * @author  Dan McAdams
19
 * @package RoadBunch\Csv\Formatter
20
 */
21
class UnderscoreToSpaceFormatter implements FormatterInterface
22
{
23
    /** @var FormatterInterface */
24
    protected $formatter;
25
26
    /**
27
     * UnderscoreToSpaceFormatter constructor.
28
     */
29
    public function __construct()
30
    {
31 3
        $this->formatter = new Formatter(function ($var) {
32 2
            return str_replace('_', ' ', $var);
33 3
        });
34 3
    }
35
36
    /**
37
     * @param array $data
38
     *
39
     * @return array
40
     */
41 2
    public function format(array $data): array
42
    {
43 2
        return $this->formatter->format($data);
44
    }
45
}
46