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 
95  public function fetchMessage() {
96  if ( $this->message === null ) {
97  $prefix = '';
98  if ( $this->isDeprecated() ) {
99  $prefix .= '<span class="apihelp-deprecated">' .
100  $this->subMessage( 'api-help-param-deprecated' ) .
101  '</span>' .
102  $this->subMessage( 'word-separator' );
103  }
104  if ( $this->isInternal() ) {
105  $prefix .= '<span class="apihelp-internal">' .
106  $this->subMessage( 'api-help-param-internal' ) .
107  '</span>' .
108  $this->subMessage( 'word-separator' );
109  }
110  $this->message = ";<span dir=\"ltr\" lang=\"en\">{$this->paramValue}</span>:"
111  . $prefix . parent::fetchMessage();
112  }
113  return $this->message;
114  }
115 
116  private function subMessage( $key ) {
117  $msg = new Message( $key );
118  $msg->interface = $this->interface;
119  $msg->language = $this->language;
120  $msg->useDatabase = $this->useDatabase;
121  $msg->contextPage = $this->contextPage;
122  return $msg->fetchMessage();
123  }
124 
125 }
ApiHelpParamValueMessage\$internal
$internal
Definition: ApiHelpParamValueMessage.php:38
ApiHelpParamValueMessage\getParamValue
getParamValue()
Fetch the parameter value.
Definition: ApiHelpParamValueMessage.php:70
Message\$contextPage
PageReference $contextPage
page object to use as context.
Definition: Message.php:201
ApiHelpParamValueMessage\isInternal
isInternal()
Fetch the 'internal' flag.
Definition: ApiHelpParamValueMessage.php:88
ApiHelpParamValueMessage\fetchMessage
fetchMessage()
Definition: ApiHelpParamValueMessage.php:95
Message\$language
Language bool $language
In which language to get this message.
Definition: Message.php:175
ApiHelpParamValueMessage\subMessage
subMessage( $key)
Definition: ApiHelpParamValueMessage.php:116
Message\$interface
bool $interface
In which language to get this message.
Definition: Message.php:168
ApiHelpParamValueMessage\$paramValue
$paramValue
Definition: ApiHelpParamValueMessage.php:36
Message\$key
string $key
The message key.
Definition: Message.php:181
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:139
Message\$useDatabase
bool $useDatabase
Whether database can be used.
Definition: Message.php:196
ApiHelpParamValueMessage
Message subclass that prepends wikitext for API help.
Definition: ApiHelpParamValueMessage.php:34
Message\$message
string null $message
Definition: Message.php:211