You are here

function drush_composer_manager_update_psr4 in Composer Manager 7

Same name and namespace in other branches
  1. 7.2 composer_manager.drush.inc \drush_composer_manager_update_psr4()

Add new PSR-4 namespaces to the class loader.

Parameters

\Composer\Autoload\ClassLoader $loader: The autoloader to add the new namespaces to.

string $composer: Path to the Composer library.

1 call to drush_composer_manager_update_psr4()
drush_composer_manager_update_autoloader in ./composer_manager.drush.inc
Add new autoloader paths to the Class Loader.

File

./composer_manager.drush.inc, line 196
Drush hook implementations for the Composer Manager module.

Code

function drush_composer_manager_update_psr4($loader, $composer) {
  $autoload_psr4 = $composer . '/autoload_psr4.php';
  if (file_exists($autoload_psr4)) {
    $updated_psr4 = (require $autoload_psr4);
    foreach ($updated_psr4 as $prefix => $paths) {
      $loader
        ->addPsr4($prefix, $paths);
    }
  }
}