Improve readability of LogFormatter::makePageLink
authorThalia <thalia.e.chan@googlemail.com>
Wed, 9 Jan 2019 15:58:16 +0000 (15:58 +0000)
committerThalia <thalia.e.chan@googlemail.com>
Wed, 9 Jan 2019 15:59:17 +0000 (15:59 +0000)
Change-Id: I912d9626b99697d5a0394b72a56ffc8a5e7aa1bb

includes/logging/LogFormatter.php

index b3afe0b..b07f20e 100644 (file)
@@ -644,18 +644,18 @@ class LogFormatter {
        protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
                if ( !$title instanceof Title ) {
                        $msg = $this->msg( 'invalidtitle' )->text();
-                       if ( !$this->plaintext ) {
-                               return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ], $msg );
-                       } else {
+                       if ( $this->plaintext ) {
                                return $msg;
+                       } else {
+                               return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ], $msg );
                        }
                }
 
-               if ( !$this->plaintext ) {
+               if ( $this->plaintext ) {
+                       $link = '[[' . $title->getPrefixedText() . ']]';
+               } else {
                        $html = $html !== null ? new HtmlArmor( $html ) : $html;
                        $link = $this->getLinkRenderer()->makeLink( $title, $html, [], $parameters );
-               } else {
-                       $link = '[[' . $title->getPrefixedText() . ']]';
                }
 
                return $link;