function drush_init_register_command_files

master preflight.inc drush_init_register_command_files($container, $commandFiles)
2 calls to drush_init_register_command_files()

File

includes/preflight.inc, line 375
Preflight, postflight and shutdown code.

Code

function drush_init_register_command_files($container, $commandFiles) {
  foreach ($commandFiles as $sourcePath => $className) {
    if (!class_exists($className)) {
      include $sourcePath;
    }
    $classAlias = str_replace('\\', '', $className);
    // Add and fetch our class from the container to apply the inductors
    $container->share($classAlias, $className);
    $commandFileInstance = $container->get($classAlias);
    if ($commandFileInstance instanceof BuilderAwareInterface) {
      $builder = $container->get('collectionBuilder', [$commandFileInstance]);
      $commandFileInstance->setBuilder($builder);
    }
    drush_add_command_instance($container, $commandFileInstance);
  }
}