* @param string $url Either fully-qualified or a local path + query
* @param string $defaultProto One of the PROTO_* constants. Determines the
* protocol to use if $url or $wgServer is protocol-relative
- * @return string Fully-qualified URL, current-path-relative URL or false if
+ * @return string|false Fully-qualified URL, current-path-relative URL or false if
* no valid URL can be constructed
*/
function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) {
* @see Message::__construct
*/
function wfMessage( $key /*...*/ ) {
+ $message = new Message( $key );
+
+ // We call Message::params() to reduce code duplication
$params = func_get_args();
array_shift( $params );
- if ( isset( $params[0] ) && is_array( $params[0] ) ) {
- $params = $params[0];
+ if ( $params ) {
+ call_user_func_array( [ $message, 'params' ], $params );
}
- return new Message( $key, $params );
+
+ return $message;
}
/**