class BootstrapManager implements LoggerAwareInterface, AutoloaderAwareInterface, ConfigAwareInterface, ContainerAwareInterface (View source)

Traits

LoggerAwareTrait
ContainerAwareTrait
ConfigAwareTrait

Properties

protected $loader from AutoloaderAwareTrait
protected DrupalFinder $drupalFinder
protected Boot[] $bootstrapCandidates
protected Boot $bootstrap
protected int $phase

Methods

setAutoloader($loader)

No description

autoloader()

No description

hasAutoloader()

No description

getConfig()

Replaces same method in ConfigAwareTrait in order to provide a DrushConfig as return type. Helps with IDE completion.

int
getPhase()

No description

setPhase(int $phase)

No description

add(Boot|Array $candidateList)

Add a bootstrap object to the list of candidates.

drupalFinder()

No description

setDrupalFinder(DrupalFinder $drupalFinder)

No description

getRoot()

Return the framework root selected by the user.

getComposerRoot()

Return the composer root for the selected Drupal site.

locateRoot($root, $start_path = null)

No description

getUri()

Return the framework uri selected by the user.

selectUri($cwd)

This method is called by the Application iff the user did not explicitly provide a URI.

setUri($uri)

No description

bootstrap()

Return the bootstrap object in use. This will be the latched bootstrap object if we have started bootstrapping; otherwise, it will be whichever bootstrap object is best for the selected root.

injectBootstrap($bootstrap)

For use in testing

bootstrapObjectForRoot($path)

Look up the best bootstrap class for the given location from the set of available candidates.

selectBootstrapClass()

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 'latched', and further calls to Drush::bootstrap() will always return the same object.

latch($bootstrap)

Once bootstrapping has started, we stash the bootstrap object being used, and do not allow it to change any longer.

array
bootstrapPhases(bool $function_names = false)

Returns an array that determines what bootstrap phases are necessary to bootstrap the CMS.

bool
doBootstrap(int $phase, int|bool $phase_max = false, AnnotationData $annotationData = null)

Bootstrap Drush to the desired phase.

hasBootstrap()

hasBootstrap determines whether the manager has a bootstrap object yet.

bool
hasBootstrapped(int $phase)

Determine whether a given bootstrap phase has been completed.

bool
bootstrapValidate(int $phase)

Validate whether a bootstrap phase can be reached.

bool
bootstrapToPhase(string $bootstrapPhase, AnnotationData $annotationData = null)

Bootstrap to the specified phase.

maxPhaseLimit($bootstrap_str)

No description

bool
bootstrapToPhaseIndex(int $max_phase_index, AnnotationData $annotationData = null)

Bootstrap to the specified phase.

int
bootstrapMax(int $max_phase_index = false, AnnotationData $annotationData = null)

Bootstrap to the highest level possible, without triggering any errors.

logger()

Allow those with an instance to us to the BootstrapManager to use its logger

inflect($object)

No description

Details

setAutoloader($loader)

Parameters

$loader

autoloader()

hasAutoloader()

DrushConfig getConfig()

Replaces same method in ConfigAwareTrait in order to provide a DrushConfig as return type. Helps with IDE completion.

int getPhase()

Return Value

int

protected setPhase(int $phase)

Parameters

int $phase

add(Boot|Array $candidateList)

Add a bootstrap object to the list of candidates.

Parameters

Boot|Array $candidateList List of boot candidates

drupalFinder()

setDrupalFinder(DrupalFinder $drupalFinder)

Parameters

DrupalFinder $drupalFinder

getRoot()

Return the framework root selected by the user.

getComposerRoot()

Return the composer root for the selected Drupal site.

locateRoot($root, $start_path = null)

Parameters

$root
$start_path

getUri()

Return the framework uri selected by the user.

selectUri($cwd)

This method is called by the Application iff the user did not explicitly provide a URI.

Parameters

$cwd

setUri($uri)

Parameters

$uri

Boot bootstrap()

Return the bootstrap object in use. This will be the latched bootstrap object if we have started bootstrapping; otherwise, it will be whichever bootstrap object is best for the selected root.

Return Value

Boot

injectBootstrap($bootstrap)

For use in testing

Parameters

$bootstrap

Boot bootstrapObjectForRoot($path)

Look up the best bootstrap class for the given location from the set of available candidates.

Parameters

$path

Return Value

Boot

protected selectBootstrapClass()

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 'latched', and further calls to Drush::bootstrap() will always return the same object.

latch($bootstrap)

Once bootstrapping has started, we stash the bootstrap object being used, and do not allow it to change any longer.

Parameters

$bootstrap

array bootstrapPhases(bool $function_names = false)

Returns an array that determines what bootstrap phases are necessary to bootstrap the CMS.

Parameters

bool $function_names (optional) If TRUE, return an array of method names index by their corresponding phase values. Otherwise return an array of phase values.

Return Value

array

See also

Boot::bootstrapPhases

bool doBootstrap(int $phase, int|bool $phase_max = false, AnnotationData $annotationData = null)

Bootstrap Drush to the desired phase.

This function will sequentially bootstrap each lower phase up to the phase that has been requested.

Parameters

int $phase The bootstrap phase to bootstrap to.
int|bool $phase_max (optional) The maximum level to boot to. This does not have a use in this function itself but can be useful for other code called from within this function, to know if e.g. a caller is in the process of booting to the specified level. If specified, it should never be lower than $phase.
AnnotationData $annotationData Optional annotation data from the command.

Return Value

bool TRUE if the specified bootstrap phase has completed.

See also

Boot::bootstrapPhases

hasBootstrap()

hasBootstrap determines whether the manager has a bootstrap object yet.

bool hasBootstrapped(int $phase)

Determine whether a given bootstrap phase has been completed.

Parameters

int $phase The bootstrap phase to test

Return Value

bool TRUE if the specified bootstrap phase has completed.

bool bootstrapValidate(int $phase)

Validate whether a bootstrap phase can be reached.

This function will validate the settings that will be used during the actual bootstrap process, and allow commands to progressively bootstrap to the highest level that can be reached.

This function will only run the validation function once, and store the result from that execution in a local static. This avoids validating phases multiple times.

Parameters

int $phase The bootstrap phase to validate to.

Return Value

bool TRUE if bootstrap is possible, FALSE if the validation failed.

See also

Boot::bootstrapPhases

bool bootstrapToPhase(string $bootstrapPhase, AnnotationData $annotationData = null)

Bootstrap to the specified phase.

Parameters

string $bootstrapPhase Name of phase to bootstrap to. Will be converted to appropriate index.
AnnotationData $annotationData Optional annotation data from the command.

Return Value

bool TRUE if the specified bootstrap phase has completed.

Exceptions

Exception Thrown when an unknown bootstrap phase is passed in the annotation data.

protected maxPhaseLimit($bootstrap_str)

Parameters

$bootstrap_str

bool bootstrapToPhaseIndex(int $max_phase_index, AnnotationData $annotationData = null)

Bootstrap to the specified phase.

Parameters

int $max_phase_index Only attempt bootstrap to the specified level.
AnnotationData $annotationData Optional annotation data from the command.

Return Value

bool TRUE if the specified bootstrap phase has completed.

int bootstrapMax(int $max_phase_index = false, AnnotationData $annotationData = null)

Bootstrap to the highest level possible, without triggering any errors.

Parameters

int $max_phase_index (optional) Only attempt bootstrap to the specified level.
AnnotationData $annotationData Optional annotation data from the command.

Return Value

int The maximum phase to which we bootstrapped.

logger()

Allow those with an instance to us to the BootstrapManager to use its logger

inflect($object)

Parameters

$object