Umherirrender has uploaded a new change for review.
https://gerrit.wikimedia.org/r/62986
Change subject: Avoid Generic accessor in Category.php
......................................................................
Avoid Generic accessor in Category.php
This php magic is hard to read
Change-Id: Ia66dfdea58e3c03bd9a95da19792d52cb1cfe956
---
M includes/Category.php
1 file changed, 35 insertions(+), 21 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/86/62986/1
diff --git a/includes/Category.php b/includes/Category.php
index 126b8fe..42c0bd2 100644
--- a/includes/Category.php
+++ b/includes/Category.php
@@ -195,29 +195,54 @@
return $cat;
}
- /** @return mixed DB key name, or false on failure */
+ /**
+ * @return mixed DB key name, or false on failure
+ */
public function getName() {
- return $this->getX( 'mName' );
+ if ( !$this->initialize() ) {
+ return false;
+ }
+ return $this->mName;
}
- /** @return mixed Category ID, or false on failure */
+ /**
+ * @return mixed Category ID, or false on failure
+ */
public function getID() {
- return $this->getX( 'mID' );
+ if ( !$this->initialize() ) {
+ return false;
+ }
+ return $this->mID;
}
- /** @return mixed Total number of member pages, or false on failure */
+ /**
+ * @return mixed Total number of member pages, or false on failure
+ */
public function getPageCount() {
- return $this->getX( 'mPages' );
+ if ( !$this->initialize() ) {
+ return false;
+ }
+ return $this->mPages;
}
- /** @return mixed Number of subcategories, or false on failure */
+ /**
+ * @return mixed Number of subcategories, or false on failure
+ */
public function getSubcatCount() {
- return $this->getX( 'mSubcats' );
+ if ( !$this->initialize() ) {
+ return false;
+ }
+ return $this->mSubcats;
}
- /** @return mixed Number of member files, or false on failure */
+ /**
+ * @return mixed Number of member files, or false on failure
+ */
public function getFileCount() {
- return $this->getX( 'mFiles' );
+ if ( !$this->initialize() ) {
+ return false;
+ }
+ return $this->mFiles;
}
/**
@@ -273,17 +298,6 @@
wfProfileOut( __METHOD__ );
return $result;
- }
-
- /**
- * Generic accessor
- * @return bool
- */
- private function getX( $key ) {
- if ( !$this->initialize() ) {
- return false;
- }
- return $this->{$key};
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/62986
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia66dfdea58e3c03bd9a95da19792d52cb1cfe956
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits