PluginInstaller   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A activate() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the phpdish/plugin-installer package.
5
 *
6
 * (c) Slince <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace PHPDish\PluginInstaller;
13
14
use Composer\Composer;
15
use Composer\IO\IOInterface;
16
use Composer\Plugin\PluginInterface;
17
use Composer\Util\Filesystem;
18
19
class PluginInstaller implements PluginInterface
20
{
21
    /**
22
     * @var string
23
     */
24
    const PLUGIN_PATH = 'plugins';
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function activate(Composer $composer, IOInterface $io)
30
    {
31
        (new Filesystem())->ensureDirectoryExists(static::PLUGIN_PATH);
32
33
        $repository = new ProxyRepository(static::PLUGIN_PATH, 2, $io, $composer->getConfig());
34
        $composer->getRepositoryManager()->addRepository($repository);
35
    }
36
}