Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Plugin.php

function Plugin::onDependenciesChangedEvent

Entry point for post install and post update events.

Throws

\InvalidArgumentException

LogicException

ProcessFailedException

RuntimeException

File

vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php, line 181

Class

Plugin
PHP_CodeSniffer standard installation manager.

Namespace

PHPCSStandards\Composer\Plugin\Installers\PHPCodeSniffer

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal