jenkins-bot has submitted this change and it was merged.

Change subject: Drop unused methods from EditEntity
......................................................................


Drop unused methods from EditEntity

I checked all methods if they are used and
* lowered visibility to private if not used outside of the class,
* dropped some methods if not used at all.

Change-Id: I21d1559cfc0d50cdf1286afd521654fcb447770e
---
M repo/includes/EditEntity.php
1 file changed, 12 insertions(+), 63 deletions(-)

Approvals:
  Jeroen De Dauw: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/EditEntity.php b/repo/includes/EditEntity.php
index 4b9dda6..cae22a7 100644
--- a/repo/includes/EditEntity.php
+++ b/repo/includes/EditEntity.php
@@ -33,6 +33,7 @@
  * @licence GNU GPL v2+
  * @author John Erling Blad < [email protected] >
  * @author Daniel Kinzler
+ * @author Thiemo Mättig
  */
 class EditEntity {
 
@@ -148,9 +149,7 @@
        /**
         * @var string[]
         */
-       private $requiredPermissions = array(
-               'edit',
-       );
+       private $requiredPermissions = array( 'edit' );
 
        /**
         * @since 0.1
@@ -226,20 +225,11 @@
        }
 
        /**
-        * Returns the ID of the entity that is being edited.
-        *
-        * @return EntityId
-        */
-       public function getEntityId() {
-               return $this->newEntity->getId();
-       }
-
-       /**
         * Returns the Title of the page holding the entity that is being 
edited.
         *
         * @return Title|null
         */
-       public function getTitle() {
+       private function getTitle() {
                if ( $this->title === null ) {
                        $id = $this->newEntity->getId();
 
@@ -278,7 +268,7 @@
         *
         * @return int 0 if the entity doesn't exist
         */
-       public function getLatestRevisionId() {
+       private function getLatestRevisionId() {
                // Don't do negative caching: We call this to see whether the 
entity yet exists
                // before creating.
                if ( $this->latestRevId === 0 ) {
@@ -295,15 +285,6 @@
                }
 
                return $this->latestRevId;
-       }
-
-       /**
-        * Returns the user who performs the edit.
-        *
-        * @return User
-        */
-       public function getUser() {
-               return $this->user;
        }
 
        /**
@@ -324,7 +305,7 @@
         *
         * @return int|bool
         */
-       public function getBaseRevisionId() {
+       private function getBaseRevisionId() {
                if ( $this->baseRevId === null || $this->baseRevId === true ) {
                        $this->baseRevId = $this->getLatestRevisionId();
                }
@@ -340,7 +321,7 @@
         * @return EntityRevision|null
         * @throws MWException
         */
-       public function getBaseRevision() {
+       private function getBaseRevision() {
                if ( $this->baseRev === null ) {
                        $baseRevId = $this->getBaseRevisionId();
 
@@ -379,7 +360,7 @@
         *
         * @since 0.1
         *
-        * @return null|Status
+        * @return Status|null
         */
        public function getStatus() {
                return $this->status;
@@ -393,28 +374,7 @@
         * @return bool false if attemptSave() failed, true otherwise
         */
        public function isSuccess() {
-               if ( $this->errorType > 0 ) {
-                       return false;
-               }
-
-               return $this->status->isOK();
-       }
-
-       /**
-        * Returns the revision created by attemptSave(), if it was successful.
-        * If attemptSave() has not yet been called or failed, null is returned.
-        *
-        * @since 0.3
-        *
-        * @return EntityRevision|null
-        */
-       public function getNewRevision() {
-               if ( $this->errorType > 0 || !$this->status || 
!$this->status->isOK() ) {
-                       return null;
-               }
-
-               $value = $this->status->getValue();
-               return isset( $value['revision'] ) ? $value['revision'] : null;
+               return $this->errorType === 0 && $this->status->isOK();
        }
 
        /**
@@ -429,17 +389,6 @@
         */
        public function hasError( $errorType = self::ANY_ERROR ) {
                return ( $this->errorType & $errorType ) !== 0;
-       }
-
-       /**
-        * Returns a bitfield indicating errors encountered while saving.
-        *
-        * @since 0.4
-        *
-        * @return int $errorType bit field using the EditEntity::XXX_ERROR 
constants.
-        */
-       public function getErrors() {
-               return $this->errorType;
        }
 
        /**
@@ -539,7 +488,7 @@
 
        /**
         * Adds another permission (action) to be checked by 
checkEditPermissions().
-        * Per default, the 'edit' permission (and if needed, the 'create' 
permission) is checked.
+        * Per default, the 'edit' permission is checked.
         *
         * @param string $permission
         */
@@ -549,7 +498,7 @@
 
        /**
         * Checks the necessary permissions to perform this edit.
-        * Per default, the 'edit' permission (and if needed, the 'create' 
permission) is checked.
+        * Per default, the 'edit' permission is checked.
         * Use addRequiredPermission() to check more permissions.
         */
        public function checkEditPermissions() {
@@ -571,7 +520,7 @@
        /**
         * Checks if rate limits have been exceeded.
         */
-       public function checkRateLimits() {
+       private function checkRateLimits() {
                if ( $this->user->pingLimiter( 'edit' )
                        || ( $this->isNew() && $this->user->pingLimiter( 
'create' ) )
                ) {
@@ -886,7 +835,7 @@
         *
         * @throws MWException
         */
-       public function updateWatchlist( $watch ) {
+       private function updateWatchlist( $watch ) {
                if ( $this->getTitle() === null ) {
                        throw new MWException( 'Title not yet known!' );
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/197539
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I21d1559cfc0d50cdf1286afd521654fcb447770e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to