MediaWiki  master
ApiHelpParamValueMessage.php
Go to the documentation of this file.
1 <?php
35 
36  protected $paramValue;
37  protected $deprecated;
38  protected $internal;
39 
53  public function __construct(
55  $text,
56  $params = [],
57  $deprecated = false,
58  $internal = false
59  ) {
60  parent::__construct( $text, $params );
61  $this->paramValue = $paramValue;
62  $this->deprecated = (bool)$deprecated;
63  $this->internal = (bool)$internal;
64  }
65 
70  public function getParamValue() {
71  return $this->paramValue;
72  }
73 
79  public function isDeprecated() {
80  return $this->deprecated;
81  }
82 
88  public function isInternal() {
89  return $this->internal;
90  }
91 
96  public function fetchMessage() {
97  if ( $this->message === null ) {
98  $prefix = '';
99  if ( $this->isDeprecated() ) {
100  $prefix .= '<span class="apihelp-deprecated">' .
101  $this->subMessage( 'api-help-param-deprecated' ) .
102  '</span>' .
103  $this->subMessage( 'word-separator' );
104  }
105  if ( $this->isInternal() ) {
106  $prefix .= '<span class="apihelp-internal">' .
107  $this->subMessage( 'api-help-param-internal' ) .
108  '</span>' .
109  $this->subMessage( 'word-separator' );
110  }
111  $this->message = ";<span dir=\"ltr\" lang=\"en\">{$this->paramValue}</span>:"
112  . $prefix . parent::fetchMessage();
113  }
114  return $this->message;
115  }
116 
117  private function subMessage( $key ) {
118  $msg = new Message( $key );
119  $msg->interface = $this->interface;
120  $msg->language = $this->language;
121  $msg->useDatabase = $this->useDatabase;
122  $msg->title = $this->title;
123  return $msg->fetchMessage();
124  }
125 
126 }
Message\$message
string $message
Definition: Message.php:239
ApiHelpParamValueMessage\$internal
$internal
Definition: ApiHelpParamValueMessage.php:38
ApiHelpParamValueMessage\getParamValue
getParamValue()
Fetch the parameter value.
Definition: ApiHelpParamValueMessage.php:70
Message\$title
Title $title
Title object to use as context.
Definition: Message.php:229
ApiHelpParamValueMessage\isInternal
isInternal()
Fetch the 'internal' flag.
Definition: ApiHelpParamValueMessage.php:88
ApiHelpParamValueMessage\fetchMessage
fetchMessage()
Fetch the message.
Definition: ApiHelpParamValueMessage.php:96
Message\$language
Language bool $language
In which language to get this message.
Definition: Message.php:197
ApiHelpParamValueMessage\subMessage
subMessage( $key)
Definition: ApiHelpParamValueMessage.php:117
Message\$interface
bool $interface
In which language to get this message.
Definition: Message.php:190
ApiHelpParamValueMessage\$paramValue
$paramValue
Definition: ApiHelpParamValueMessage.php:36
Message\$key
string $key
The message key.
Definition: Message.php:203
ApiHelpParamValueMessage\__construct
__construct( $paramValue, $text, $params=[], $deprecated=false, $internal=false)
Definition: ApiHelpParamValueMessage.php:53
ApiHelpParamValueMessage\isDeprecated
isDeprecated()
Fetch the 'deprecated' flag.
Definition: ApiHelpParamValueMessage.php:79
ApiHelpParamValueMessage\$deprecated
$deprecated
Definition: ApiHelpParamValueMessage.php:37
Message
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition: Message.php:161
Message\$useDatabase
bool $useDatabase
Whether database can be used.
Definition: Message.php:224
ApiHelpParamValueMessage
Message subclass that prepends wikitext for API help.
Definition: ApiHelpParamValueMessage.php:34