Passed
Push — master ( 5d84bb...783534 )
by Evgenii
01:10
created

Plugin   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 5 1
A activate() 0 2 1
A install() 0 7 1
1
<?php
2
3
namespace Helick\Composer;
4
5
use Composer\Composer;
6
use Composer\EventDispatcher\EventSubscriberInterface;
7
use Composer\IO\IOInterface;
8
use Composer\Plugin\PluginInterface;
9
10
final class Plugin implements PluginInterface, EventSubscriberInterface
11
{
12
    /**
13
     * @inheritDoc
14
     */
15
    public static function getSubscribedEvents()
16
    {
17
        return [
18
            'post-install-cmd' => ['install'],
19
            'post-update-cmd'  => ['install'],
20
        ];
21
    }
22
23
    /**
24
     * @inheritDoc
25
     */
26
    public function activate(Composer $composer, IOInterface $io)
27
    {
28
        //
29
    }
30
31
    /**
32
     * Kick-off the installation.
33
     *
34
     * @return void
35
     */
36
    public function install(): void
37
    {
38
        $source = dirname(__DIR__, 1) . '/resources/stubs';
39
        $dest   = dirname($source, 2) . '/web';
40
41
        copy($source . '/index.php.stub', $dest . '/index.php');
42
        copy($source . '/wp-config.php.stub', $dest . '/wp-config.php');
43
    }
44
}
45