r82365 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82364‎ | r82365 | r82366 >
Date:00:33, 18 February 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
2 subclasses of ResourceLoaderWikiModule implement a duplicate version of getFlip. Move it up into ResourceLoaderWikiModule

(Almost looks like it could all go into ResourceLoaderModule... But that uses a different version, seemingly, the only one. 3 other subclasses of ResourceLoaderModule implement the same version of getFlip as is moved into a parent class here... Seems daft to have a different version in the base abstract class... Minor oversight?)

Some documentation
Modified paths:
  • /trunk/phase3/includes/resourceloader/ResourceLoaderModule.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoaderSiteModule.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoaderUserGroupsModule.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoaderUserModule.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoaderWikiModule.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/resourceloader/ResourceLoaderSiteModule.php
@@ -60,10 +60,4 @@
6161 public function getGroup() {
6262 return 'site';
6363 }
64 -
65 - public function getFlip( $context ) {
66 - global $wgContLang;
67 -
68 - return $wgContLang->getDir() !== $context->getDirection();
69 - }
7064 }
Index: trunk/phase3/includes/resourceloader/ResourceLoaderUserGroupsModule.php
@@ -52,10 +52,4 @@
5353 public function getGroup() {
5454 return 'user';
5555 }
56 -
57 - public function getFlip( $context ) {
58 - global $wgContLang;
59 -
60 - return $wgContLang->getDir() !== $context->getDirection();
61 - }
6256 }
Index: trunk/phase3/includes/resourceloader/ResourceLoaderUserModule.php
@@ -48,10 +48,4 @@
4949 public function getGroup() {
5050 return 'user';
5151 }
52 -
53 - public function getFlip( $context ) {
54 - global $wgContLang;
55 -
56 - return $wgContLang->getDir() !== $context->getDirection();
57 - }
5852 }
Index: trunk/phase3/includes/resourceloader/ResourceLoaderModule.php
@@ -108,6 +108,7 @@
109109 /**
110110 * Get whether CSS for this module should be flipped
111111 * @param $context ResourceLoaderContext
 112+ * @return bool
112113 */
113114 public function getFlip( $context ) {
114115 return $context->getDirection() === 'rtl';
Index: trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -217,6 +217,10 @@
218218 return $this->modifiedTime[$hash] = $time;
219219 }
220220
 221+ /**
 222+ * @param $context ResourceLoaderContext
 223+ * @return bool
 224+ */
221225 public function getFlip( $context ) {
222226 global $wgContLang;
223227
Index: trunk/phase3/includes/resourceloader/ResourceLoaderWikiModule.php
@@ -145,4 +145,14 @@
146146 $this->modifiedTime[$hash] = $modifiedTime;
147147 return $modifiedTime;
148148 }
 149+
 150+ /**
 151+ * @param $context ResourceLoaderContext
 152+ * @return bool
 153+ */
 154+ public function getFlip( $context ) {
 155+ global $wgContLang;
 156+
 157+ return $wgContLang->getDir() !== $context->getDirection();
 158+ }
149159 }

Comments

#Comment by Reedy (talk | contribs)   00:34, 18 February 2011

Make that 3.

Status & tagging log