MissingPatchesResolver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A resolve() 0 11 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\PackageResolvers;
7
8
class MissingPatchesResolver implements \Vaimo\ComposerPatches\Interfaces\PatchPackagesResolverInterface
9
{
10
    /**
11
     * @var \Vaimo\ComposerPatches\Utils\PackagePatchDataUtils
12
     */
13
    private $patchDataUtils;
14
15
    /**
16
     * @var \Vaimo\ComposerPatches\Utils\PatchListUtils
17
     */
18
    private $patchListUtils;
19
20
    public function __construct()
21
    {
22
        $this->patchDataUtils = new \Vaimo\ComposerPatches\Utils\PackagePatchDataUtils();
23
        $this->patchListUtils = new \Vaimo\ComposerPatches\Utils\PatchListUtils();
24
    }
25
26
    public function resolve(array $patches, array $repositoryState)
27
    {
28
        $patchDataUtils = $this->patchDataUtils;
29
30
        return $this->patchListUtils->compareLists(
31
            $patches,
32
            $repositoryState,
33
            function ($packagePatches, $packageState) use ($patchDataUtils) {
34
                return $patchDataUtils->shouldReinstall(
35
                    $packageState,
36
                    $packagePatches
37
                );
38
            }
39
        );
40
    }
41
}
42