MergerComponent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 13 3
1
<?php
2
/**
3
 * Copyright © Vaimo Group. All rights reserved.
4
 * See LICENSE_VAIMO.txt for license details.
5
 */
6
namespace Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents;
7
8
use Vaimo\ComposerPatches\Patch\Definition as PatchDefinition;
9
10
class MergerComponent implements \Vaimo\ComposerPatches\Interfaces\DefinitionListLoaderComponentInterface
11
{
12
    /**
13
     * @param array $patches
14
     * @param \Composer\Package\PackageInterface[] $packagesByName
15
     * @return array
16
     */
17
    public function process(array $patches, array $packagesByName)
18
    {
19
        $allPatches = array();
20
21
        foreach ($patches as $patchTarget => $packagePatches) {
22
            $allPatches[$patchTarget] = array();
23
24
            foreach ($packagePatches as $info) {
25
                $allPatches[$patchTarget][$info[PatchDefinition::SOURCE]] = $info;
26
            }
27
        }
28
29
        return array_filter($allPatches);
30
    }
31
}
32