StateGenerator::generate()   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;
7
8
use Composer\Repository\WritableRepositoryInterface as PackageRepository;
9
10
use Vaimo\ComposerPatches\Config as PluginConfig;
11
12
class StateGenerator
13
{
14
    /**
15
     * @var \Vaimo\ComposerPatches\Package\Collector
16
     */
17
    private $packageCollector;
18
19
    /**
20
     * @var \Vaimo\ComposerPatches\Utils\PackageListUtils
21
     */
22
    private $packageListUtils;
23
24
    /**
25
     * @param \Vaimo\ComposerPatches\Package\Collector $packageCollector
26
     */
27
    public function __construct(
28
        \Vaimo\ComposerPatches\Package\Collector $packageCollector
29
    ) {
30
        $this->packageCollector = $packageCollector;
31
32
        $this->packageListUtils = new \Vaimo\ComposerPatches\Utils\PackageListUtils();
33
    }
34
35
    public function generate(PackageRepository $repository)
36
    {
37
        $packages = $this->packageCollector->collect($repository);
38
39
        return $this->packageListUtils->extractDataFromExtra(
40
            $packages,
41
            PluginConfig::APPLIED_FLAG,
42
            array()
43
        );
44
    }
45
}
46