UpperCaseWordsFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
nc 1
nop 1
dl 0
loc 6
c 0
b 0
f 0
cc 1
rs 9.4285
ccs 4
cts 4
cp 1
crap 1
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 UpperCaseWordsFormatter
17
 *
18
 * @author  Dan McAdams
19
 * @package RoadBunch\Csv\Formatter
20
 */
21
class UpperCaseWordsFormatter extends AbstractFormatter
22
{
23
    /**
24
     * @param array $data
25
     *
26
     * @return array
27
     * @throws \RoadBunch\Csv\Exception\FormatterResultException
28
     */
29
    public static function format(array $data): array
30
    {
31 2
        return self::applyFilter(function($var) {
32 2
            $del = [" ", "-", "_", "."];
33 2
            return ucwords($var, implode('', $del));
34 2
        }, $data);
35
    }
36
}
37