1 | <?php |
||
51 | class SiteAliasName |
||
52 | { |
||
53 | protected $location; |
||
54 | protected $sitename; |
||
55 | protected $env; |
||
56 | |||
57 | /** |
||
58 | * Match the parts of a regex name. |
||
59 | */ |
||
60 | const ALIAS_NAME_REGEX = '%^@?([a-zA-Z0-9_-]+)(\.[a-zA-Z0-9_-]+)?(\.[a-zA-Z0-9_-]+)?$%'; |
||
61 | |||
62 | /** |
||
63 | * Create a new site alias name |
||
64 | * |
||
65 | * @param string $item |
||
66 | * @return SiteAliasName |
||
67 | */ |
||
68 | public static function parse($item) |
||
74 | |||
75 | /** |
||
76 | * The 'location' of an alias file is defined as being the name |
||
77 | * of the immediate parent of the alias file. e.g. the path |
||
78 | * '$HOME/.drush/sites/isp/mysite.site.yml' would have a location |
||
79 | * of 'isp' and a sitename of 'mysite'. The environments of the site |
||
80 | * are defined by the alias contents. |
||
81 | * |
||
82 | * @param type $path |
||
83 | * @return type |
||
84 | */ |
||
85 | public static function locationFromPath($path) |
||
93 | |||
94 | /** |
||
95 | * Creae a SiteAliasName object from an alias name string. |
||
96 | * |
||
97 | * @param string $sitename The alias name for the site. |
||
98 | * @param string $env The name for the site's environment. |
||
99 | * @param string $location The location filter for the site. |
||
100 | */ |
||
101 | public function __construct($sitename = null, $env = null, $location = null) |
||
107 | |||
108 | /** |
||
109 | * Convert an alias name back to a string. |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | public function __toString() |
||
124 | |||
125 | /** |
||
126 | * Determine whether or not the provided name is an alias name. |
||
127 | * |
||
128 | * @param string $aliasName |
||
129 | * @return bool |
||
130 | */ |
||
131 | public static function isAliasName($aliasName) |
||
139 | |||
140 | /** |
||
141 | * Return the sitename portion of the alias name. By definition, |
||
142 | * every alias must have a sitename. If the site name is implicit, |
||
143 | * then 'self' is assumed. |
||
144 | * |
||
145 | * @return string |
||
146 | */ |
||
147 | public function sitename() |
||
154 | |||
155 | /** |
||
156 | * Return the sitename portion of the alias name. By definition, |
||
157 | * every alias must have a sitename. If the site name is implicit, |
||
158 | * then 'self' is assumed. |
||
159 | * |
||
160 | * @return string |
||
161 | */ |
||
162 | public function sitenameWithLocation() |
||
169 | |||
170 | /** |
||
171 | * Set the sitename portion of the alias name |
||
172 | * |
||
173 | * @param string $sitename |
||
174 | */ |
||
175 | public function setSitename($sitename) |
||
180 | |||
181 | /** |
||
182 | * In general, all aliases have a sitename. The time when one will not |
||
183 | * is when an environment name `@env` is used as a shortcut for `@self.env` |
||
184 | * |
||
185 | * @return bool |
||
186 | */ |
||
187 | public function hasSitename() |
||
191 | |||
192 | /** |
||
193 | * Return true if this alias name contains an 'env' portion. |
||
194 | * |
||
195 | * @return bool |
||
196 | */ |
||
197 | public function hasEnv() |
||
201 | |||
202 | /** |
||
203 | * Set the environment portion of the alias name. |
||
204 | * |
||
205 | * @param string |
||
206 | */ |
||
207 | public function setEnv($env) |
||
212 | |||
213 | /** |
||
214 | * Return the 'env' portion of the alias name. |
||
215 | * |
||
216 | * @return string |
||
217 | */ |
||
218 | public function env() |
||
222 | |||
223 | /** |
||
224 | * Return true if this alias name contains a 'location' portion |
||
225 | * @return bool |
||
226 | */ |
||
227 | public function hasLocation() |
||
231 | |||
232 | /** |
||
233 | * Set the 'loation' portion of the alias name. |
||
234 | * @param string $location |
||
235 | */ |
||
236 | public function setLocation($location) |
||
241 | |||
242 | /** |
||
243 | * Return the 'location' portion of the alias name. |
||
244 | * |
||
245 | * @param string |
||
246 | */ |
||
247 | public function location() |
||
251 | |||
252 | /** |
||
253 | * Return true if this alias name is the 'self' alias. |
||
254 | * |
||
255 | * @return bool |
||
256 | */ |
||
257 | public function isSelf() |
||
261 | |||
262 | /** |
||
263 | * Return true if this alias name is the 'none' alias. |
||
264 | */ |
||
265 | public function isNone() |
||
269 | |||
270 | /** |
||
271 | * Convert the parts of an alias name to its various component parts. |
||
272 | * |
||
273 | * @param string $aliasName a string representation of an alias name. |
||
274 | */ |
||
275 | protected function doParse($aliasName) |
||
314 | |||
315 | /** |
||
316 | * Process an alias name provided as '@sitename'. |
||
317 | * |
||
318 | * @param string $sitename |
||
|
|||
319 | * @return true |
||
320 | */ |
||
321 | protected function processSingleItem($item) |
||
331 | |||
332 | /** |
||
333 | * Determine whether the requested name is a special alias name. |
||
334 | * |
||
335 | * @param string $item |
||
336 | * @return boolean |
||
337 | */ |
||
338 | protected function isSpecialAliasName($item) |
||
342 | } |
||
343 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.