function Plugin::onDependenciesChangedEvent
Entry point for post install and post update events.
Throws
\InvalidArgumentException
File
-
vendor/
dealerdirect/ phpcodesniffer-composer-installer/ src/ Plugin.php, line 181
Class
- Plugin
- PHP_CodeSniffer standard installation manager.
Namespace
PHPCSStandards\Composer\Plugin\Installers\PHPCodeSnifferCode
public function onDependenciesChangedEvent() {
$io = $this->io;
$isVerbose = $io->isVerbose();
$exitCode = 0;
if ($isVerbose) {
$io->write(sprintf('<info>%s</info>', self::MESSAGE_RUNNING_INSTALLER));
}
if ($this->isPHPCodeSnifferInstalled() === true) {
$this->loadInstalledPaths();
$installPathCleaned = $this->cleanInstalledPaths();
$installPathUpdated = $this->updateInstalledPaths();
if ($installPathCleaned === true || $installPathUpdated === true) {
$exitCode = $this->saveInstalledPaths();
}
elseif ($isVerbose) {
$io->write(sprintf('<info>%s</info>', self::MESSAGE_NOTHING_TO_INSTALL));
}
}
else {
$pluginPackage = $this->composer
->getRepositoryManager()
->getLocalRepository()
->findPackages(self::PLUGIN_NAME);
$isPluginUninstalled = count($pluginPackage) === 0;
if ($isPluginUninstalled) {
if ($isVerbose) {
$io->write(sprintf('<info>%s</info>', self::MESSAGE_PLUGIN_UNINSTALLED));
}
}
else {
$exitCode = 1;
if ($isVerbose) {
$io->write(sprintf('<error>%s</error>', self::MESSAGE_NOT_INSTALLED));
}
}
}
return $exitCode;
}