1 | <?php |
||
7 | class SiteAliasManager implements SiteAliasManagerInterface, SiteAliasManagerInitializationInterface |
||
8 | { |
||
9 | protected $aliasLoader; |
||
10 | protected $selfSiteAlias; |
||
11 | protected $specParser; |
||
12 | protected $root = ''; |
||
13 | |||
14 | /** |
||
15 | * Constructor for SiteAliasManager |
||
16 | * |
||
17 | * @param SiteAliasFileLoader|null $aliasLoader an alias loader |
||
18 | */ |
||
19 | public function __construct($aliasLoader = null, $root = '') |
||
26 | |||
27 | /** |
||
28 | * Allow configuration data to be used in replacements in the alias file. |
||
29 | */ |
||
30 | public function setReferenceData($data) |
||
35 | |||
36 | /** |
||
37 | * Inject the root of the selected site |
||
38 | * |
||
39 | * @param string $root |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function setRoot($root) |
||
48 | |||
49 | /** |
||
50 | * Add a search location to our site alias discovery object. |
||
51 | * |
||
52 | * @param string $path |
||
53 | * |
||
54 | * @return $this |
||
55 | */ |
||
56 | public function addSearchLocation($path) |
||
61 | |||
62 | /** |
||
63 | * Add search locations to our site alias discovery object. |
||
64 | * |
||
65 | * @param array $paths Any path provided in --alias-path option |
||
66 | * or drush.path.alias-path configuration item. |
||
67 | * |
||
68 | * @return $this |
||
69 | */ |
||
70 | public function addSearchLocations(array $paths) |
||
77 | |||
78 | /** |
||
79 | * Return all of the paths where alias files may be found. |
||
80 | * @return string[] |
||
81 | */ |
||
82 | public function searchLocations() |
||
86 | |||
87 | /** |
||
88 | * Get an alias record by name, or convert a site specification |
||
89 | * into an alias record via the site alias spec parser. If a |
||
90 | * simple alias name is provided (e.g. '@alias'), it is interpreted |
||
91 | * as a sitename, and the default environment for that site is returned. |
||
92 | * |
||
93 | * @param string $name Alias name or site specification |
||
94 | * |
||
95 | * @return SiteAlias|false |
||
96 | */ |
||
97 | public function get($name) |
||
109 | |||
110 | /** |
||
111 | * Get the '@self' alias record. |
||
112 | * |
||
113 | * @return SiteAlias |
||
114 | */ |
||
115 | public function getSelf() |
||
119 | |||
120 | /** |
||
121 | * Force-set the current @self alias. |
||
122 | * |
||
123 | * @param SiteAlias $selfSiteAlias |
||
124 | * @return $this |
||
125 | */ |
||
126 | public function setSelf(SiteAlias $selfSiteAlias) |
||
132 | |||
133 | /** |
||
134 | * Get an alias record from a name. Does not accept site specifications. |
||
135 | * |
||
136 | * @param string $aliasName alias name |
||
137 | * |
||
138 | * @return SiteAlias |
||
139 | */ |
||
140 | public function getAlias($aliasName) |
||
157 | |||
158 | /** |
||
159 | * Given a simple alias name, e.g. '@alias', returns all of the |
||
160 | * environments in the specified site. |
||
161 | * |
||
162 | * If the provided name is a site specification et. al., |
||
163 | * then this method will return 'false'. |
||
164 | * |
||
165 | * @param string $name Alias name |
||
166 | * @return SiteAlias[]|false |
||
167 | */ |
||
168 | public function getMultiple($name = '') |
||
204 | |||
205 | /** |
||
206 | * Return the paths to all alias files in all search locations known |
||
207 | * to the alias manager. |
||
208 | * |
||
209 | * @return string[] |
||
210 | */ |
||
211 | public function listAllFilePaths($location = '') |
||
215 | } |
||
216 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: