Composer.php 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
<?php

/**
 * @file
 * Contains \Drupal\Core\Composer\Composer.
 */

namespace Drupal\Core\Composer;

use Composer\Script\Event;

/**
 * Provides static functions for composer script events.
 *
 * @see https://getcomposer.org/doc/articles/scripts.md
 */
class Composer {

  /**
   * Add vendor classes to composers static classmap.
   */
  public static function preAutoloadDump(Event $event) {
    $composer = $event->getComposer();
    $package = $composer->getPackage();
    $autoload = $package->getAutoload();
    $autoload['classmap'] = array_merge($autoload['classmap'], array(
      'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php',
      'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php',
      'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php',
      'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php',
      'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php',
      'vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php',
      'vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php',
      'vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php'
    ));
    $package->setAutoload($autoload);
  }

}