Removed unneeded else branches in DifferenceEngine
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Sun, 25 Aug 2013 07:26:20 +0000 (09:26 +0200)
committerIAlex <codereview@emsenhuber.ch>
Tue, 17 Sep 2013 06:51:05 +0000 (06:51 +0000)
The "if" always exit, so there is no need to use else branches;
also added blank lines for better readability.

Change-Id: I7d8321652a90fbba99e53fa0c1fe018492883b8a

includes/diff/DifferenceEngine.php

index 3ff5c98..e73754d 100644 (file)
@@ -1181,26 +1181,29 @@ class DifferenceEngine extends ContextSource {
        function loadText() {
                if ( $this->mTextLoaded == 2 ) {
                        return true;
-               } else {
-                       // Whether it succeeds or fails, we don't want to try again
-                       $this->mTextLoaded = 2;
                }
 
+               // Whether it succeeds or fails, we don't want to try again
+               $this->mTextLoaded = 2;
+
                if ( !$this->loadRevisionData() ) {
                        return false;
                }
+
                if ( $this->mOldRev ) {
                        $this->mOldContent = $this->mOldRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
                        if ( $this->mOldContent === null ) {
                                return false;
                        }
                }
+
                if ( $this->mNewRev ) {
                        $this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
                        if ( $this->mNewContent === null ) {
                                return false;
                        }
                }
+
                return true;
        }
 
@@ -1212,13 +1215,16 @@ class DifferenceEngine extends ContextSource {
        function loadNewText() {
                if ( $this->mTextLoaded >= 1 ) {
                        return true;
-               } else {
-                       $this->mTextLoaded = 1;
                }
+
+               $this->mTextLoaded = 1;
+
                if ( !$this->loadRevisionData() ) {
                        return false;
                }
+
                $this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
+
                return true;
        }
 }