Passed
Pull Request — master (#13)
by Dmitriy
19:37 queued 04:56
created

ComposerEventHandler::onPostAutoloadDump()   A

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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config;
6
7
use Composer\Composer;
8
use Composer\EventDispatcher\EventSubscriberInterface;
9
use Composer\IO\IOInterface;
10
use Composer\Plugin\PluginInterface;
11
use Composer\Script\ScriptEvents;
12
13
final class ComposerEventHandler implements PluginInterface, EventSubscriberInterface
14
{
15
    /**
16
     * Returns list of events the plugin is subscribed to.
17
     *
18
     * @return array list of events
19
     */
20
    public static function getSubscribedEvents(): array
21
    {
22
        return [
23
            ScriptEvents::POST_AUTOLOAD_DUMP => [
24
                ['onPostAutoloadDump', 0],
25
            ],
26
        ];
27
    }
28
29
    public function activate(Composer $composer, IOInterface $io): void
30
    {
31
        $this->plugin = new Plugin($composer, $io);
0 ignored issues
show
Bug Best Practice introduced by
The property plugin does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
32
    }
33
34
    public function onPostAutoloadDump()
35
    {
36
        $this->plugin->build();
37
    }
38
}
39