MapSettings::format()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
/**
4
 * This file is part of SebastianFeldmann\Git.
5
 *
6
 * (c) Sebastian Feldmann <[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 SebastianFeldmann\Git\Command\Config\ListSettings;
13
14
use SebastianFeldmann\Cli\Command\OutputFormatter;
15
16
/**
17
 * Class MapSettings
18
 *
19
 * @package SebastianFeldmann\Git
20
 * @author  Sebastian Feldmann <[email protected]>
21
 * @link    https://github.com/sebastianfeldmann/git
22
 * @since   Class available since Release 1.0.8
23
 */
24
class MapSettings implements OutputFormatter
25
{
26
    /**
27
     * Format the output.
28
     *
29
     * @param  array $output
30 1
     * @return iterable
31
     */
32 1
    public function format(array $output): iterable
33 1
    {
34 1
        $formatted = [];
35 1
        foreach ($output as $row) {
36
            $keyValue                      = explode('=', $row);
37 1
            $formatted[trim($keyValue[0])] = trim(implode('=', array_slice($keyValue, 1)));
38
        }
39
        return $formatted;
40
    }
41
}
42