ComposerOperationAnalyser::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Copyright © Vaimo Group. All rights reserved.
4
 * See LICENSE_VAIMO.txt for license details.
5
 */
6
namespace Vaimo\ComposerChangelogs\Analysers;
7
8
use Composer\DependencyResolver\Operation\OperationInterface;
9
10
class ComposerOperationAnalyser
11
{
12
    /**
13
     * @var \Vaimo\ComposerChangelogs\Analysers\PackageAnalyser
14
     */
15
    private $packageAnalyser;
16
    
17
    public function __construct()
18
    {
19
        $this->packageAnalyser = new \Vaimo\ComposerChangelogs\Analysers\PackageAnalyser();
20
    }
21
22
    public function isPluginUninstallOperation(OperationInterface $operation)
23
    {
24
        if (!$operation instanceof \Composer\DependencyResolver\Operation\UninstallOperation) {
25
            return false;
26
        }
27
28
        $package = $operation->getPackage();
29
30
        return $this->packageAnalyser->isPluginPackage($package)
31
            && $this->packageAnalyser->ownsNamespace($package, __NAMESPACE__);
32
    }
33
}
34