2 namespace Consolidation\SiteAlias;
4 use Consolidation\Config\Config;
5 use Consolidation\Config\ConfigInterface;
6 use Consolidation\Config\Util\ArrayUtil;
9 * An alias record is a configuration record containing well-known items.
11 * NOTE: AliasRecord is implemented as a Config subclass; however, it
12 * should not be used as a config. (A better implementation would be
13 * "hasa" config, but that is less convenient, as we want all of the
14 * same capabilities as a config object).
16 * If using an alias record as config is desired, use the 'exportConfig()'
19 * Example remote alias:
24 * root: /path/to/drupal
27 * Example local alias with global and command-specific options:
30 * root: /path/to/drupal
33 * no-interaction: true
40 interface AliasRecordInterface extends ConfigInterface
43 * Get a value from the provided config option. Values stored in
44 * this alias record will override the configuration values, if present.
46 * If multiple alias records need to be chained together in a more
47 * complex priority arrangement, @see \Consolidation\Config\Config\ConfigOverlay.
49 * @param ConfigInterface $config The configuration object to pull fallback data from
50 * @param string $key The data item to fetch
51 * @param mixed $default The default value to return if there is no match
55 public function getConfig(ConfigInterface $config, $key, $default = null);
58 * Return the name of this alias record.
62 public function name();
65 * Remember the name of this record
69 public function setName($name);
72 * Determine whether this alias has a root.
74 public function hasRoot();
79 public function root();
84 public function uri();
91 public function setUri($uri);
94 * Return user@host, or just host if there is no user. Returns
95 * an empty string if there is no host.
99 public function remoteHostWithUser();
102 * Get the remote user
104 public function remoteUser();
107 * Return true if this alias record has a remote user
109 public function hasRemoteUser();
112 * Get the remote host
114 public function remoteHost();
117 * Return true if this alias record has a remote host that is not
120 public function isRemote();
123 * Return true if this alias record is for the local system
125 public function isLocal();
128 * Determine whether this alias does not represent any site. An
129 * alias record must either be remote or have a root.
131 public function isNone();
134 * Return the 'root' element of this alias if this alias record
137 public function localRoot();
140 * Export the configuration values in this alias record, and reconfigure
141 * them so that the layout matches that of the global configuration object.
143 public function exportConfig();