LocalExcludeComponent::process()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 17
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 8
c 0
b 0
f 0
nc 4
nop 2
dl 0
loc 17
rs 10
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 LocalExcludeComponent 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
        foreach ($patches as &$packagePatches) {
20
            foreach ($packagePatches as &$patchData) {
21
                if (!$patchData[PatchDefinition::SKIP]) {
22
                    continue;
23
                }
24
25
                $patchData = false;
26
            }
27
28
            unset($patchData);
29
30
            $packagePatches = array_filter($packagePatches);
31
        }
32
33
        return array_filter($patches);
34
    }
35
}
36