| 1 |
<?php |
| 2 |
|
| 3 |
s |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
namespace MediaWiki\Api; |
| 24 |
|
| 25 |
use MediaWiki\Message\Message; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
class ApiHelpParamValueMessage extends Message { |
| 39 |
|
| 40 |
|
| 41 |
protected $paramValue; |
| 42 |
|
| 43 |
protected $deprecated; |
| 44 |
|
| 45 |
protected $internal; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
public function __construct( |
| 60 |
$paramValue, |
| 61 |
$text, |
| 62 |
$params = [], |
| 63 |
$deprecated = false, |
| 64 |
$internal = false |
| 65 |
) { |
| 66 |
parent::__construct( $text, $params ); |
| 67 |
$this->paramValue = $paramValue; |
| 68 |
$this->deprecated = (bool)$deprecated; |
| 69 |
$this->internal = (bool)$internal; |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
public function getParamValue() { |
| 77 |
return $this->paramValue; |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
public function isDeprecated() { |
| 86 |
return $this->deprecated; |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
public function isInternal() { |
| 95 |
return $this->internal; |
| 96 |
} |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
public function fetchMessage() { |
| 102 |
if ( $this->message === null ) { |
| 103 |
$prefix = ";<span dir=\"ltr\" lang=\"en\">{$this->paramValue}</span>:"; |
| 104 |
if ( $this->isDeprecated() ) { |
| 105 |
$prefix .= '<span class="apihelp-deprecated">' . |
| 106 |
$this->subMessage( 'api-help-param-deprecated' ) . |
| 107 |
'</span>' . |
| 108 |
$this->subMessage( 'word-separator' ); |
| 109 |
} |
| 110 |
if ( $this->isInternal() ) { |
| 111 |
$prefix .= '<span class="apihelp-internal">' . |
| 112 |
$this->subMessage( 'api-help-param-internal' ) . |
| 113 |
'</span>' . |
| 114 |
$this->subMessage( 'word-separator' ); |
| 115 |
} |
| 116 |
|
| 117 |
if ( $this->getLanguage()->getCode() === 'qqx' ) { |
| 118 |
|
| 119 |
$keylist = implode( ' / ', $this->keysToTry ); |
| 120 |
if ( $this->overriddenKey !== null ) { |
| 121 |
$keylist .= ' = ' . $this->overriddenKey; |
| 122 |
} |
| 123 |
$this->message = $prefix . "($keylist$*)"; |
| 124 |
} else { |
| 125 |
$this->message = $prefix . parent::fetchMessage(); |
| 126 |
} |
| 127 |
} |
| 128 |
return $this->message; |
| 129 |
} |
| 130 |
|
| 131 |
private function subMessage( $key ) { |
| 132 |
$msg = new Message( $key ); |
| 133 |
$msg->isInterface = $this->isInterface; |
| 134 |
$msg->language = $this->language; |
| 135 |
$msg->useDatabase = $this->useDatabase; |
| 136 |
$msg->contextPage = $this->contextPage; |
| 137 |
return $msg->plain(); |
| 138 |
} |
| 139 |
|
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
class_alias( ApiHelpParamValueMessage::class, 'ApiHelpParamValueMessage' ); |