aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Reed <reedy@users.mediawiki.org>2011-09-14 15:07:20 +0000
committerSam Reed <reedy@users.mediawiki.org>2011-09-14 15:07:20 +0000
commitfb32210aeed6e64c3572df4d7109f1bc0b19fc4f (patch)
tree5b77ba944c7e49ae1ff96482d72ce9ec7b183f4b
parent4a0c3c1fa8a3c7bc8740167d80a76799db3bf52e (diff)
downloadmediawikicore-fb32210aeed6e64c3572df4d7109f1bc0b19fc4f.tar.gz
mediawikicore-fb32210aeed6e64c3572df4d7109f1bc0b19fc4f.zip
Whitespace/documentation
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/97060
-rw-r--r--includes/Message.php27
-rw-r--r--includes/cache/MessageCache.php16
-rw-r--r--includes/parser/Parser.php4
-rw-r--r--tests/phpunit/includes/MessageTest.php2
4 files changed, 33 insertions, 16 deletions
diff --git a/includes/Message.php b/includes/Message.php
index 87349ff5fa10..803f091c33bc 100644
--- a/includes/Message.php
+++ b/includes/Message.php
@@ -11,7 +11,7 @@
* $button = Xml::button( wfMessage( 'submit' )->text() );
* </pre>
* Messages can have parameters:
- * wfMessage( 'welcome-to' )->params( $wgSitename )->text();
+ * wfMessage( 'welcome-to' )->params( $wgSitename )->text();
* {{GRAMMAR}} and friends work correctly
* wfMessage( 'are-friends', $user, $friend );
* wfMessage( 'bad-message' )->rawParams( '<script>...</script>' )->escaped();
@@ -60,7 +60,7 @@ class Message {
* means the current interface language, false content language.
*/
protected $interface = true;
-
+
/**
* In which language to get this message. Overrides the $interface
* variable.
@@ -68,7 +68,7 @@ class Message {
* @var Language
*/
protected $language = null;
-
+
/**
* The message key.
*/
@@ -101,6 +101,11 @@ class Message {
protected $title = null;
/**
+ * @var string
+ */
+ protected $message;
+
+ /**
* Constructor.
* @param $key: message key, or array of message keys to try and use the first non-empty message for
* @param $params Array message parameters
@@ -181,7 +186,7 @@ class Message {
}
return $this;
}
-
+
/**
* Add parameters that are numeric and will be passed through
* Language::formatNum before substitution
@@ -198,7 +203,7 @@ class Message {
}
return $this;
}
-
+
/**
* Request the message in any language that is supported.
* As a side effect interface message status is unconditionally
@@ -216,7 +221,7 @@ class Message {
} else {
$type = gettype( $lang );
throw new MWException( __METHOD__ . " must be "
- . "passed a String or Language object; $type given"
+ . "passed a String or Language object; $type given"
);
}
$this->interface = false;
@@ -268,10 +273,10 @@ class Message {
*/
public function toString() {
$string = $this->getMessageText();
-
+
# Replace parameters before text parsing
$string = $this->replaceParameters( $string, 'before' );
-
+
# Maybe transform using the full parser
if( $this->format === 'parse' ) {
$string = $this->parseText( $string );
@@ -287,10 +292,10 @@ class Message {
$string = $this->transformText( $string );
$string = htmlspecialchars( $string, ENT_QUOTES, 'UTF-8', false );
}
-
+
# Raw parameter replacement
$string = $this->replaceParameters( $string, 'after' );
-
+
return $string;
}
@@ -303,7 +308,7 @@ class Message {
public function __toString() {
return $this->toString();
}
-
+
/**
* Fully parse the text from wikitext to HTML
* @return String parsed HTML
diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php
index 7255ae705044..d16f63e2d9bf 100644
--- a/includes/cache/MessageCache.php
+++ b/includes/cache/MessageCache.php
@@ -544,6 +544,8 @@ class MessageCache {
/**
* Represents a write lock on the messages key
*
+ * @param $key string
+ *
* @return Boolean: success
*/
function lock( $key ) {
@@ -576,6 +578,8 @@ class MessageCache {
* fallback).
* @param $isFullKey Boolean: specifies whether $key is a two part key
* "msg/lang".
+ *
+ * @return string|false
*/
function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
global $wgLanguageCode, $wgContLang;
@@ -677,6 +681,8 @@ class MessageCache {
*
* @param $title String: Message cache key with initial uppercase letter.
* @param $code String: code denoting the language to try.
+ *
+ * @return string|false
*/
function getMsgFromNamespace( $title, $code ) {
global $wgAdaptiveMessageCache;
@@ -795,10 +801,9 @@ class MessageCache {
/**
* @param $text string
- * @param $string Title|string
* @param $title Title
- * @param $interface bool
* @param $linestart bool
+ * @param $interface bool
* @param $language
* @return ParserOutput
*/
@@ -859,6 +864,10 @@ class MessageCache {
$this->mLoadedLanguages = array();
}
+ /**
+ * @param $key
+ * @return array
+ */
public function figureMessage( $key ) {
global $wgLanguageCode;
$pieces = explode( '/', $key );
@@ -916,6 +925,9 @@ class MessageCache {
wfProfileOut( __METHOD__ );
}
+ /**
+ * @return array
+ */
public function getMostUsedMessages() {
wfProfileIn( __METHOD__ );
$cachekey = wfMemcKey( 'message-profiling' );
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 1698fe79372f..744f2e62ef68 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -5292,7 +5292,7 @@ class Parser {
* not found, $mode=get will return $newtext, and $mode=replace will return $text.
*
* Section 0 is always considered to exist, even if it only contains the empty
- * string. If $text is the empty string and section 0 is replaced, $newText is
+ * string. If $text is the empty string and section 0 is replaced, $newText is
* returned.
*
* @param $mode String: one of "get" or "replace"
@@ -5427,7 +5427,7 @@ class Parser {
/**
* This function returns $oldtext after the content of the section
- * specified by $section has been replaced with $text. If the target
+ * specified by $section has been replaced with $text. If the target
* section does not exist, $oldtext is returned unchanged.
*
* @param $oldtext String: former text of the article
diff --git a/tests/phpunit/includes/MessageTest.php b/tests/phpunit/includes/MessageTest.php
index 45c02bbe7562..295b6d74a91d 100644
--- a/tests/phpunit/includes/MessageTest.php
+++ b/tests/phpunit/includes/MessageTest.php
@@ -47,7 +47,7 @@ class MessageTest extends MediaWikiLangTestCase {
$this->assertEquals( 'Main Page', wfMessage( 'mainpage' )->inContentLanguage()->plain(), 'ForceUIMsg disabled' );
$wgForceUIMsgAsContentMsg['testInContentLanguage'] = 'mainpage';
$this->assertEquals( 'Accueil', wfMessage( 'mainpage' )->inContentLanguage()->plain(), 'ForceUIMsg enabled' );
-
+
/* Restore globals */
$wgLang = $oldLang;
unset( $wgForceUIMsgAsContentMsg['testInContentLanguage'] );