MediaWiki  1.34.4
ExprError.php
Go to the documentation of this file.
1 <?php
20 
21 use Exception;
22 use Message;
23 
24 class ExprError extends Exception {
26  private $mwMessage;
27 
32  public function __construct( $msg, $parameter = '' ) {
33  // Give grep a chance to find the usages:
34  // pfunc_expr_stack_exhausted, pfunc_expr_unexpected_number, pfunc_expr_preg_match_failure,
35  // pfunc_expr_unrecognised_word, pfunc_expr_unexpected_operator, pfunc_expr_missing_operand,
36  // pfunc_expr_unexpected_closing_bracket, pfunc_expr_unrecognised_punctuation,
37  // pfunc_expr_unclosed_bracket, pfunc_expr_division_by_zero, pfunc_expr_invalid_argument,
38  // pfunc_expr_invalid_argument_ln, pfunc_expr_unknown_error, pfunc_expr_not_a_number
39  $this->mwMessage = wfMessage( "pfunc_expr_$msg", $parameter );
40  }
41 
48  public function getUserFriendlyMessage() {
49  return $this->mwMessage->inContentLanguage()->text();
50  }
51 }
MediaWiki\Extensions\ParserFunctions\ExprError\__construct
__construct( $msg, $parameter='')
Definition: ExprError.php:32
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1263
MediaWiki\Extensions\ParserFunctions\ExprError\$mwMessage
Message $mwMessage
Definition: ExprError.php:26
MediaWiki\Extensions\ParserFunctions
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
Definition: ExprError.php:19
MediaWiki\Extensions\ParserFunctions\ExprError\getUserFriendlyMessage
getUserFriendlyMessage()
Replacement for getMessage() to prevent message parsing during tests which initializes whole bloody M...
Definition: ExprError.php:48
Message
The Message class provides methods which fulfil two basic services:
Definition: Message.php:162
MediaWiki\Extensions\ParserFunctions\ExprError
Definition: ExprError.php:24