Merge "Don't fallback from uk to ru"
[lhc/web/wiklou.git] / includes / api / ApiHelpParamValueMessage.php
1 <?php
2 /**
3 *
4 *
5 * Created on Dec 22, 2014
6 *
7 * Copyright © 2014 Brad Jorsch <bjorsch@wikimedia.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
23 *
24 * @file
25 */
26
27 /**
28 * Message subclass that prepends wikitext for API help.
29 *
30 * This exists so the apihelp-*-paramvalue-*-* messages don't all have to
31 * include markup wikitext while still keeping the
32 * 'APIGetParamDescriptionMessages' hook simple.
33 *
34 * @since 1.25
35 */
36 class ApiHelpParamValueMessage extends Message {
37
38 protected $paramValue;
39
40 /**
41 * @see Message::__construct
42 *
43 * @param string $paramValue Parameter value being documented
44 * @param string $text Message to use.
45 * @param array $params Parameters for the message.
46 * @throws InvalidArgumentException
47 */
48 public function __construct( $paramValue, $text, $params = [] ) {
49 parent::__construct( $text, $params );
50 $this->paramValue = $paramValue;
51 }
52
53 /**
54 * Fetch the parameter value
55 * @return string
56 */
57 public function getParamValue() {
58 return $this->paramValue;
59 }
60
61 /**
62 * Fetch the message.
63 * @return string
64 */
65 public function fetchMessage() {
66 if ( $this->message === null ) {
67 $this->message = ";<span dir=\"ltr\" lang=\"en\">{$this->paramValue}</span>:"
68 . parent::fetchMessage();
69 }
70 return $this->message;
71 }
72
73 }