Skip to content
Snippets Groups Projects
Plugin.php 1.21 KiB
Newer Older
  • Learn to ignore specific revisions
  • jurgenhaas's avatar
    jurgenhaas committed
    <?php
    
    namespace LakeDrops\Behat4Drupal;
    
    use Composer\Script\Event;
    use Composer\Script\ScriptEvents;
    
    use LakeDrops\Component\Composer\BasePlugin;
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    /**
     * Composer plugin for handling drupal scaffold.
     */
    
    class Plugin extends BasePlugin {
    
    jurgenhaas's avatar
    jurgenhaas committed
    
      /**
       * {@inheritdoc}
       */
    
      public function getHandlerClass() {
        return Handler::class;
    
    jurgenhaas's avatar
    jurgenhaas committed
      }
    
      /**
       * {@inheritdoc}
       */
      public static function getSubscribedEvents() {
        return array(
          ScriptEvents::POST_CREATE_PROJECT_CMD => 'postCreateProject',
        );
      }
    
      /**
       * Post create project event callback.
       *
       * @param \Composer\Script\Event $event
       *   The event that triggered the plugin.
       */
      public function postCreateProject(Event $event) {
        $this->handler->configureProject($event);
      }
    
      /**
       * Script callback for putting in composer scripts to configure the project.
       *
       * @param \Composer\Script\Event $event
       *   The event that triggered the call of this function.
    
       *
       * @throws \Twig_Error_Loader
       * @throws \Twig_Error_Runtime
       * @throws \Twig_Error_Syntax
    
    jurgenhaas's avatar
    jurgenhaas committed
       */
      public static function config(Event $event) {
        $handler = new Handler($event->getComposer(), $event->getIO());
        $handler->configureProject($event, TRUE);
      }
    
    }