InclusiveListResolver::resolvePatchesQueue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright © Vaimo Group. All rights reserved.
4
 * See LICENSE_VAIMO.txt for license details.
5
 */
6
namespace Vaimo\ComposerPatches\Repository\PatchesApplier\ListResolvers;
7
8
class InclusiveListResolver implements \Vaimo\ComposerPatches\Interfaces\ListResolverInterface
9
{
10
    /**
11
     * @var \Vaimo\ComposerPatches\Interfaces\ListResolverInterface
12
     */
13
    private $baseResolver;
14
15
    /**
16
     * @var \Vaimo\ComposerPatches\Patch\DefinitionList\Analyser
17
     */
18
    private $patchListAnalyser;
19
20
    /**
21
     * @var \Vaimo\ComposerPatches\Utils\PatchListUtils
22
     */
23
    private $patchListUtils;
24
25
    /**
26
     * @param \Vaimo\ComposerPatches\Interfaces\ListResolverInterface $baseResolver
27
     */
28
    public function __construct(
29
        \Vaimo\ComposerPatches\Interfaces\ListResolverInterface $baseResolver
30
    ) {
31
        $this->baseResolver = $baseResolver;
32
33
        $this->patchListAnalyser = new \Vaimo\ComposerPatches\Patch\DefinitionList\Analyser();
34
        $this->patchListUtils = new \Vaimo\ComposerPatches\Utils\PatchListUtils();
35
    }
36
37
    public function resolvePatchesQueue(array $patches)
38
    {
39
        $matches = $this->baseResolver->resolvePatchesQueue($patches);
40
        $targets = $this->patchListAnalyser->getAllTargets($matches);
41
42
        return $this->patchListUtils->mergeLists(
43
            $this->patchListUtils->filterListByTargets($patches, $targets),
44
            $matches
45
        );
46
    }
47
48
    public function resolveRelevantPatches(array $patches, array $subset)
49
    {
50
        return $patches;
51
    }
52
53
    public function resolveInitialState(array $patches, array $state)
54
    {
55
        return $this->baseResolver->resolveInitialState($patches, $state);
56
    }
57
}
58