1 | <?php |
||
7 | class SiteAliasManager |
||
8 | { |
||
9 | protected $aliasLoader; |
||
10 | protected $selfAliasRecord; |
||
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) |
||
34 | |||
35 | /** |
||
36 | * Inject the root of the selected site |
||
37 | * |
||
38 | * @param string $root |
||
39 | * @return $this |
||
40 | */ |
||
41 | public function setRoot($root) |
||
46 | |||
47 | /** |
||
48 | * Add a search location to our site alias discovery object. |
||
49 | * |
||
50 | * @param string $path |
||
51 | * |
||
52 | * @return $this |
||
53 | */ |
||
54 | public function addSearchLocation($path) |
||
59 | |||
60 | /** |
||
61 | * Add search locations to our site alias discovery object. |
||
62 | * |
||
63 | * @param array $paths Any path provided in --alias-path option |
||
64 | * or drush.path.alias-path configuration item. |
||
65 | * |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function addSearchLocations(array $paths) |
||
75 | |||
76 | /** |
||
77 | * Return all of the paths where alias files may be found. |
||
78 | * @return string[] |
||
79 | */ |
||
80 | public function searchLocations() |
||
84 | |||
85 | /** |
||
86 | * Get an alias record by name, or convert a site specification |
||
87 | * into an alias record via the site alias spec parser. If a |
||
88 | * simple alias name is provided (e.g. '@alias'), it is interpreted |
||
89 | * as a sitename, and the default environment for that site is returned. |
||
90 | * |
||
91 | * @param string $name Alias name or site specification |
||
92 | * |
||
93 | * @return AliasRecord|false |
||
94 | */ |
||
95 | public function get($name) |
||
107 | |||
108 | /** |
||
109 | * Get the '@self' alias record. |
||
110 | * |
||
111 | * @return AliasRecord |
||
112 | */ |
||
113 | public function getSelf() |
||
117 | |||
118 | /** |
||
119 | * Force-set the current @self alias. |
||
120 | * |
||
121 | * @param AliasRecord $selfAliasRecord |
||
122 | * @return $this |
||
123 | */ |
||
124 | public function setSelf(AliasRecord $selfAliasRecord) |
||
130 | |||
131 | /** |
||
132 | * Get an alias record from a name. Does not accept site specifications. |
||
133 | * |
||
134 | * @param string $aliasName alias name |
||
135 | * |
||
136 | * @return AliasRecord |
||
137 | */ |
||
138 | public function getAlias($aliasName) |
||
155 | |||
156 | /** |
||
157 | * Given a simple alias name, e.g. '@alias', returns all of the |
||
158 | * environments in the specified site. |
||
159 | * |
||
160 | * If the provided name is a site specification et. al., |
||
161 | * then this method will return 'false'. |
||
162 | * |
||
163 | * @param string $name Alias name or site specification |
||
164 | * @return AliasRecord[]|false |
||
165 | */ |
||
166 | public function getMultiple($name) |
||
190 | |||
191 | /** |
||
192 | * Return the paths to all alias files in all search locations known |
||
193 | * to the alias manager. |
||
194 | * |
||
195 | * @return string[] |
||
196 | */ |
||
197 | public function listAllFilePaths() |
||
201 | } |
||
202 |
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: