2 namespace Drush\SiteAlias;
5 * Parse a string that contains a site alias name, and provide convenience
6 * methods to access the parts.
8 * When provided by users, aliases must be in one of the following forms:
10 * - @sitename.env: List only sitename and environment.
12 * - @env: Look up a named environment in instances where the site root
13 * is known (e.g. via cwd). In this form, there is an implicit sitename
14 * 'self' which is replaced by the actual site alias name once known.
16 * - @sitename: Provides only the sitename; uses the 'default' environment,
17 * or 'dev' if there is no 'default' (or whatever is there if there is
18 * only one). With this form, the site alias name has no environment
19 * until the appropriate default environment is looked up. This form
20 * is checked only after `@env` returns no matches.
22 * There are also two special aliases that are recognized:
24 * - @self: The current bootstrapped site.
26 * - @none: No alias ('root' and 'uri' unset).
28 * The special alias forms have no environment component.
30 * When provided to an API, the '@' is optional.
32 * Note that @sitename and @env are ambiguous. Aliases in this form
33 * (that are not one of the special aliases) will first be assumed
34 * to be @env, and may be converted to @sitename later.
38 * - 'sitename' and 'env' MUST NOT contain a '.' (unlike previous
40 * - Users SHOULD NOT create any environments that have the same name
41 * as any site name (and visa-versa).
42 * - All environments in one site record SHOULD be different versions
43 * of the same site (e.g. dev / test / live).
45 class SiteAliasName extends \Consolidation\SiteAlias\SiteAliasName