-
jurgenhaas authoredjurgenhaas authored
Plugin.php 1.34 KiB
<?php
namespace LakeDrops\Docker4Drupal;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
use LakeDrops\Component\Composer\BaseHandlerInterface;
use LakeDrops\Component\Composer\BasePlugin;
/**
* Composer plugin for handling docker4drupal setup.
*/
class Plugin extends BasePlugin {
/**
* {@inheritdoc}
*/
public function getHandlerClass(): BaseHandlerInterface {
return Handler::class;
}
/**
* {@inheritdoc}
*/
public function getCapabilities(): array {
return [
\Composer\Plugin\Capability\CommandProvider::class => CommandProvider::class,
];
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents(): array {
return [
ScriptEvents::POST_CREATE_PROJECT_CMD => 'configureProject',
ScriptEvents::POST_INSTALL_CMD => 'configureProject',
ScriptEvents::POST_UPDATE_CMD => 'configureProject',
];
}
/**
* Configure project event callback.
*
* @param \Composer\Script\Event $event
* The event that triggered the call of this function.
*
* @throws \Twig\Error\LoaderError
* @throws \Twig\Error\RuntimeError
* @throws \Twig\Error\SyntaxError
*/
public function configureProject(Event $event) {
/** @var Handler $handler */
$handler = $this->handler;
$handler
->setEvent($event)
->configureProject();
}
}