| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/enoikio/vendor/drupal/core-composer-scaffold/ |
Upload File : |
<?php
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Installer\PackageEvent;
use Composer\Installer\PackageEvents;
use Composer\Plugin\Capability\CommandProvider;
use Composer\Plugin\Capable;
use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents;
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
use Drupal\Composer\Plugin\Scaffold\CommandProvider as ScaffoldCommandProvider;
/**
* Composer plugin for handling drupal scaffold.
*
* @internal
*/
class Plugin implements PluginInterface, EventSubscriberInterface, Capable {
/**
* The Composer Scaffold handler.
*
* @var \Drupal\Composer\Plugin\Scaffold\Handler
*/
protected $handler;
/**
* {@inheritdoc}
*/
public function activate(Composer $composer, IOInterface $io) {
// We use a Handler object to separate the main functionality
// of this plugin from the Composer API. This also avoids some
// debug issues with the plugin being copied on initialisation.
// @see \Composer\Plugin\PluginManager::registerPackage()
$this->handler = new Handler($composer, $io);
}
/**
* {@inheritdoc}
*/
public function getCapabilities() {
return [CommandProvider::class => ScaffoldCommandProvider::class];
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
ScriptEvents::POST_UPDATE_CMD => 'postCmd',
ScriptEvents::POST_INSTALL_CMD => 'postCmd',
PackageEvents::POST_PACKAGE_INSTALL => 'postPackage',
PluginEvents::COMMAND => 'onCommand',
];
}
/**
* Post command event callback.
*
* @param \Composer\Script\Event $event
* The Composer event.
*/
public function postCmd(Event $event) {
$this->handler->scaffold();
}
/**
* Post package event behaviour.
*
* @param \Composer\Installer\PackageEvent $event
* Composer package event sent on install/update/remove.
*/
public function postPackage(PackageEvent $event) {
$this->handler->onPostPackageEvent($event);
}
/**
* Pre command event callback.
*
* @param \Composer\Plugin\CommandEvent $event
* The Composer command event.
*/
public function onCommand(CommandEvent $event) {
if ($event->getCommandName() == 'require') {
$this->handler->beforeRequire($event);
}
}
}