Shorten ternary expressions in RawAction.php
authorwithoutaname <drevitchi@gmail.com>
Wed, 23 Jul 2014 04:13:47 +0000 (21:13 -0700)
committerwithoutaname <drevitchi@gmail.com>
Wed, 23 Jul 2014 19:02:37 +0000 (12:02 -0700)
Change-Id: Idc9e74344989bf1394e05ebaf23cfd9a8fb38e1a

includes/actions/RawAction.php

index 4baf7b9..37e6e66 100644 (file)
@@ -205,10 +205,11 @@ class RawAction extends FormlessAction {
                switch ( $this->getRequest()->getText( 'direction' ) ) {
                        case 'next':
                                # output next revision, or nothing if there isn't one
+                               $nextid = 0;
                                if ( $oldid ) {
-                                       $oldid = $this->getTitle()->getNextRevisionID( $oldid );
+                                       $nextid = $this->getTitle()->getNextRevisionID( $oldid );
                                }
-                               $oldid = $oldid ? $oldid : -1;
+                               $oldid = $nextid ?: -1;
                                break;
                        case 'prev':
                                # output previous revision, or nothing if there isn't one
@@ -216,8 +217,8 @@ class RawAction extends FormlessAction {
                                        # get the current revision so we can get the penultimate one
                                        $oldid = $this->page->getLatest();
                                }
-                               $prev = $this->getTitle()->getPreviousRevisionID( $oldid );
-                               $oldid = $prev ? $prev : -1;
+                               $previd = $this->getTitle()->getPreviousRevisionID( $oldid );
+                               $oldid = $previd ?: -1;
                                break;
                        case 'cur':
                                $oldid = 0;