Introduce mediawiki.RegExp module
[mediawiki.git] / includes / api / ApiHelpParamValueMessage.php
blob7cf3d6edb8f499bf6eb3d8e77490a5c5808da9d5
1 <?php
2 /**
5 * Created on Dec 22, 2014
7 * Copyright © 2014 Brad Jorsch <bjorsch@wikimedia.org>
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.
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.
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
24 * @file
27 /**
28 * Message subclass that prepends wikitext for API help.
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.
34 * @since 1.25
36 class ApiHelpParamValueMessage extends Message {
38 protected $paramValue;
40 /**
41 * @see Message::__construct
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
48 public function __construct( $paramValue, $text, $params = array() ) {
49 parent::__construct( $text, $params );
50 $this->paramValue = $paramValue;
53 /**
54 * Fetch the parameter value
55 * @return string
57 public function getParamValue() {
58 return $this->paramValue;
61 /**
62 * Fetch the message.
63 * @return string
65 public function fetchMessage() {
66 if ( $this->message === null ) {
67 $this->message = ";{$this->paramValue}:" . parent::fetchMessage();
69 return $this->message;