actions: Improve Action class code for clarity & consistency
authorDerick Alangi <alangiderick@gmail.com>
Mon, 25 Feb 2019 12:28:37 +0000 (13:28 +0100)
committerDerick Alangi <alangiderick@gmail.com>
Mon, 25 Feb 2019 12:28:37 +0000 (13:28 +0100)
~ Move local variable $obj to one liner as it's redundant in
  this case.
~ Use === check instead of == as in order case above for the
  purpose of consistency.
~ Make use of single quotes for strings literals instead of
  double quotes.

Change-Id: I69650cacb0658a7369147ea5e9933fb5585e3376

includes/actions/Action.php

index f288a5c..f892c5e 100644 (file)
@@ -101,8 +101,7 @@ abstract class Action implements MessageLocalizer {
                        if ( !class_exists( $classOrCallable ) ) {
                                return false;
                        }
-                       $obj = new $classOrCallable( $page, $context );
-                       return $obj;
+                       return new $classOrCallable( $page, $context );
                }
 
                if ( is_callable( $classOrCallable ) ) {
@@ -142,7 +141,7 @@ abstract class Action implements MessageLocalizer {
                        } else {
                                $actionName = 'view';
                        }
-               } elseif ( $actionName == 'editredlink' ) {
+               } elseif ( $actionName === 'editredlink' ) {
                        $actionName = 'edit';
                }
 
@@ -359,7 +358,7 @@ abstract class Action implements MessageLocalizer {
         */
        protected function setHeaders() {
                $out = $this->getOutput();
-               $out->setRobotPolicy( "noindex,nofollow" );
+               $out->setRobotPolicy( 'noindex,nofollow' );
                $out->setPageTitle( $this->getPageTitle() );
                $out->setSubtitle( $this->getDescription() );
                $out->setArticleRelated( true );