r112786 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112785‎ | r112786 | r112787 >
Date:09:51, 1 March 2012
Author:nikerabbit
Status:ok
Tags:
Comment:
Documentation check
Modified paths:
  • /trunk/extensions/Translate/utils/MessageHandle.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/utils/MessageHandle.php
@@ -28,8 +28,8 @@
2929 }
3030
3131 /**
32 - * Check if a title is in a message namespace.
33 - * @return bool If title is in a message namespace.
 32+ * Check if this handle is in a message namespace.
 33+ * @return bool
3434 */
3535 public function isMessageNamespace() {
3636 global $wgTranslateMessageNamespaces;
@@ -38,7 +38,8 @@
3939 }
4040
4141 /**
42 - * @return Array of the message and the language
 42+ * Recommended to use getCode and getKey instead.
 43+ * @return Array of the message key and the language code
4344 */
4445 public function figureMessage() {
4546 if ( $this->key === null ) {
@@ -61,6 +62,7 @@
6263 }
6364
6465 /**
 66+ * Returns the identified or guessed message key.
6567 * @return String
6668 */
6769 public function getKey() {
@@ -69,6 +71,8 @@
7072 }
7173
7274 /**
 75+ * Returns the language code.
 76+ * For language codeless source messages will return empty string.
7377 * @return String
7478 */
7579 public function getCode() {
@@ -87,12 +91,20 @@
8892
8993 /**
9094 * Determine whether the current handle is for page translation feature.
 95+ * This does not consider whether the handle corresponds to any message.
9196 * @return bool
9297 */
9398 public function isPageTranslation() {
9499 return $this->getTitle()->getNamespace() == NS_TRANSLATIONS;
95100 }
96101
 102+ /**
 103+ * Returns all message group ids this message belongs to.
 104+ * The primary message group id is always the first one.
 105+ * If the handle does not correspond to any message, the returned array
 106+ * is empty.
 107+ * @return array
 108+ */
97109 public function getGroupIds() {
98110 if ( $this->groupIds === null ) {
99111 $this->groupIds = TranslateUtils::messageKeyToGroups( $this->getTitle()->getNamespace(), $this->getKey() );
@@ -111,17 +123,18 @@
112124 }
113125
114126 /**
115 - * Checks if the title corresponds to a known message.
 127+ * Checks if the handle corresponds to a known message.
116128 * @since 2011-03-16
117 - * @return \bool
 129+ * @return bool
118130 */
119131 public function isValid() {
120132 return $this->isMessageNamespace() && $this->getGroupIds();
121133 }
122134
123135 /**
 136+ * Get the original title.
124137 * @return Title
125 - */
 138+ */
126139 public function getTitle() {
127140 return $this->title;
128141 }
@@ -129,8 +142,8 @@
130143 /**
131144 * Check if a string contains the fuzzy string.
132145 *
133 - * @param $text \string Arbitrary text
134 - * @return \bool If string contains fuzzy string.
 146+ * @param $text string Arbitrary text
 147+ * @return bool If string contains fuzzy string.
135148 */
136149 public static function hasFuzzyString( $text ) {
137150 return strpos( $text, TRANSLATE_FUZZY ) !== false;
@@ -154,7 +167,6 @@
155168 );
156169
157170 $res = $dbr->selectField( $tables, $field, $conds, __METHOD__ );
158 -
159171 return $res !== false;
160172 }
161173

Status & tagging log