function drush_get_bootstrap_candidates

8.0.x bootstrap.inc drush_get_bootstrap_candidates()
7.x bootstrap.inc drush_get_bootstrap_candidates()

Return the list of bootstrap objects that are available for initializing a CMS with Drush. We insure that any given candidate class is instantiated only once.

Return value

\Drush\Boot\Boot[]

2 calls to drush_get_bootstrap_candidates()
drush_bootstrap_class_for_root in includes/bootstrap.inc
Look up the best bootstrap class for the given location from the set of available candidates.
drush_select_bootstrap_class in includes/bootstrap.inc
Select the bootstrap class to use. If this is called multiple times, the bootstrap class returned might change on subsequent calls, if the root directory changes. Once the bootstrap object starts changing the state of the system, however, it will be…

File

includes/bootstrap.inc, line 119

Code

function drush_get_bootstrap_candidates() {
  $candidate_classes = drush_get_bootstrap_candidate_classnames();

  $cache = &drush_get_context('DRUSH_BOOTSTRAP_CANDIDATE_OBJECTS');

  $result = array();
  foreach ($candidate_classes as $candidate_class) {
    if (array_key_exists($candidate_class, $cache)) {
      $result[$candidate_class] = $cache[$candidate_class];
    }
    else {
      $result[$candidate_class] = new $candidate_class;
    }
  }

  $cache = $result;
  return $result;
}