-
Notifications
You must be signed in to change notification settings - Fork 0
/
BasePlugin.php
111 lines (93 loc) · 3.09 KB
/
BasePlugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
namespace Kewlar\Composer;
use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\Installer\InstallerEvent;
use Composer\Installer\InstallerEvents;
use Composer\Installer\PackageEvent;
use Composer\Installer\PackageEvents;
use Composer\IO\IOInterface;
use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents;
use Composer\Plugin\PluginInterface;
use Composer\Plugin\PreFileDownloadEvent;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
/**
* Class BasePlugin
* @package Kewlar\Composer
*/
class BasePlugin implements PluginInterface, EventSubscriberInterface
{
/** @type Composer */
protected $composer;
/** @type IOInterface */
protected $io;
/**
* @inheritdoc
*/
public function activate(Composer $composer, IOInterface $io)
{
$this->composer = $composer;
$this->io = $io;
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
/**
* @inheritdoc
*/
public static function getSubscribedEvents()
{
return [
PluginEvents::COMMAND => 'onCommand',
PluginEvents::PRE_FILE_DOWNLOAD => 'onPreFileDownload',
ScriptEvents::PRE_UPDATE_CMD => 'onPreUpdateCmd',
ScriptEvents::POST_UPDATE_CMD => 'onPostUpdateCmd',
InstallerEvents::PRE_DEPENDENCIES_SOLVING => 'onPreDependenciesSolving',
InstallerEvents::POST_DEPENDENCIES_SOLVING => 'onPostDependenciesSolving',
PackageEvents::PRE_PACKAGE_UPDATE => 'onPrePackageUpdate',
PackageEvents::POST_PACKAGE_UPDATE => 'onPostPackageUpdate',
PackageEvents::PRE_PACKAGE_INSTALL => 'onPrePackageInstall',
PackageEvents::POST_PACKAGE_INSTALL => 'onPostPackageInstall',
];
}
public function onCommand(CommandEvent $event)
{
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
public function onPreFileDownload(PreFileDownloadEvent $event)
{
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
public function onPreUpdateCmd(Event $event)
{
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
public function onPostUpdateCmd(Event $event)
{
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
public function onPrePackageUpdate(PackageEvent $event)
{
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
public function onPostPackageUpdate(PackageEvent $event)
{
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
public function onPrePackageInstall(PackageEvent $event)
{
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
public function onPostPackageInstall(PackageEvent $event)
{
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
public function onPreDependenciesSolving(InstallerEvent $event)
{
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
public function onPostDependenciesSolving(InstallerEvent $event)
{
$this->io->write(__CLASS__ . '::'. __METHOD__ . "()");
}
}