Passed
Branch master (4a352c)
by Allan
04:38 queued 02:31
created

ItemBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createMultiple() 0 13 2
A createItem() 0 5 1
1
<?php
2
/**
3
 * Copyright © Vaimo Group. All rights reserved.
4
 * See LICENSE_VAIMO.txt for license details.
5
 */
6
namespace Vaimo\ComposerPatches\Patch\Definition\Exploder;
7
8
class ItemBuilder
9
{
10
    public function createItem($label, $item, $updates)
11
    {
12
        return array(
13
            $label,
14
            array_replace($item, $updates)
15
        );
16
    }
17
    
18
    public function createMultiple($label, $data, $keyName)
19
    {
20
        $items = array();
21
22
        foreach ($data as $source => $subItem) {
23
            $items[] = $this->createItem(
24
                $label,
25
                $subItem,
26
                array($keyName => $source)
27
            );
28
        }
29
30
        return $items;
31
    }
32
}
33