class SiteAliasManager implements SiteAliasManagerInterface, SiteAliasManagerInitializationInterface (View source)

Site Alias manager

Properties

protected $aliasLoader
protected $selfSiteAlias
protected $specParser
protected $root

Methods

__construct(SiteAliasFileLoader|null $aliasLoader = null, $root = '')

Constructor for SiteAliasManager

setReferenceData($data)

Allow configuration data to be used in replacements in the alias file.

$this
setRoot(string $root)

Inject the root of the selected site

$this
addSearchLocation(string $path)

Add a search location to our site alias discovery object.

$this
addSearchLocations(array $paths)

Add search locations to our site alias discovery object.

string[]
searchLocations()

Return all of the paths where alias files may be found.

SiteAlias|false
get(string $name)

Get an alias record by name, or convert a site specification into an alias record via the site alias spec parser. If a simple alias name is provided (e.g. '@alias'), it is interpreted as a sitename, and the default environment for that site is returned.

getSelf()

Get the '@self' alias record.

$this
setSelf(SiteAlias $selfSiteAlias)

Force-set the current @self alias.

getAlias(string $aliasName)

Get an alias record from a name. Does not accept site specifications.

SiteAlias[]|false
getMultiple(string $name = '')

Given a simple alias name, e.g. '@alias', returns all of the environments in the specified site.

string[]
listAllFilePaths($location = '')

Return the paths to all alias files in all search locations known to the alias manager.

Details

__construct(SiteAliasFileLoader|null $aliasLoader = null, $root = '')

Constructor for SiteAliasManager

Parameters

SiteAliasFileLoader|null $aliasLoader

an alias loader

$root

setReferenceData($data)

Allow configuration data to be used in replacements in the alias file.

Parameters

$data

$this setRoot(string $root)

Inject the root of the selected site

Parameters

string $root

Return Value

$this

$this addSearchLocation(string $path)

Add a search location to our site alias discovery object.

Parameters

string $path

Return Value

$this

$this addSearchLocations(array $paths)

Add search locations to our site alias discovery object.

Parameters

array $paths

Any path provided in --alias-path option or drush.path.alias-path configuration item.

Return Value

$this

string[] searchLocations()

Return all of the paths where alias files may be found.

Return Value

string[]

SiteAlias|false get(string $name)

Get an alias record by name, or convert a site specification into an alias record via the site alias spec parser. If a simple alias name is provided (e.g. '@alias'), it is interpreted as a sitename, and the default environment for that site is returned.

Parameters

string $name

Alias name or site specification

Return Value

SiteAlias|false

SiteAlias getSelf()

Get the '@self' alias record.

Return Value

SiteAlias

$this setSelf(SiteAlias $selfSiteAlias)

Force-set the current @self alias.

Parameters

SiteAlias $selfSiteAlias

Return Value

$this

SiteAlias getAlias(string $aliasName)

Get an alias record from a name. Does not accept site specifications.

Parameters

string $aliasName

alias name

Return Value

SiteAlias

SiteAlias[]|false getMultiple(string $name = '')

Given a simple alias name, e.g. '@alias', returns all of the environments in the specified site.

If the provided name is a site specification et. al., then this method will return 'false'.

Parameters

string $name

Alias name

Return Value

SiteAlias[]|false

string[] listAllFilePaths($location = '')

Return the paths to all alias files in all search locations known to the alias manager.

Parameters

$location

Return Value

string[]