You are here

protected function Plugin::handler in Drupal 10

Same name and namespace in other branches
  1. 8 composer/Plugin/Scaffold/Plugin.php \Drupal\Composer\Plugin\Scaffold\Plugin::handler()
  2. 9 composer/Plugin/Scaffold/Plugin.php \Drupal\Composer\Plugin\Scaffold\Plugin::handler()

Lazy-instantiate the handler object. It is dangerous to update a Composer plugin if it loads any classes prior to the `composer update` operation, and later tries to use them in a post-update hook.

2 calls to Plugin::handler()
Plugin::postCmd in composer/Plugin/Scaffold/Plugin.php
Post command event callback.
Plugin::postPackage in composer/Plugin/Scaffold/Plugin.php
Post package event behavior.

File

composer/Plugin/Scaffold/Plugin.php, line 135

Class

Plugin
Composer plugin for handling drupal scaffold.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

protected function handler() {
  if (!$this->handler) {
    $this->handler = new Handler($this->composer, $this->io);

    // On instantiation of our handler, notify it if the 'require' command
    // was executed.
    if ($this->requireWasCalled) {
      $this->handler
        ->requireWasCalled();
    }
  }
  return $this->handler;
}