Minor code clean up in SpecialBooksources
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 8 Jun 2015 14:15:18 +0000 (15:15 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 18 Feb 2016 17:02:53 +0000 (17:02 +0000)
Change-Id: Ife378fe87c237123c299ded9a79286abeb8fa34b

includes/specials/SpecialBooksources.php

index d185203..fe90a4f 100644 (file)
@@ -34,9 +34,6 @@ class SpecialBookSources extends SpecialPage {
         */
        private $isbn = '';
 
-       /**
-        * Constructor
-        */
        public function __construct() {
                parent::__construct( 'Booksources' );
        }
@@ -49,9 +46,9 @@ class SpecialBookSources extends SpecialPage {
        public function execute( $isbn ) {
                $this->setHeaders();
                $this->outputHeader();
-               $this->isbn = self::cleanIsbn( $isbn ? $isbn : $this->getRequest()->getText( 'isbn' ) );
+               $this->isbn = self::cleanIsbn( $isbn ?: $this->getRequest()->getText( 'isbn' ) );
                $this->getOutput()->addHTML( $this->makeForm() );
-               if ( strlen( $this->isbn ) > 0 ) {
+               if ( $this->isbn !== '' ) {
                        if ( !self::isValidISBN( $this->isbn ) ) {
                                $this->getOutput()->wrapWikiMsg(
                                        "<div class=\"error\">\n$1\n</div>",
@@ -63,7 +60,8 @@ class SpecialBookSources extends SpecialPage {
        }
 
        /**
-        * Returns whether a given ISBN (10 or 13) is valid. True indicates validity.
+        * Return whether a given ISBN (10 or 13) is valid.
+        *
         * @param string $isbn ISBN passed for check
         * @return bool
         */
@@ -154,7 +152,7 @@ class SpecialBookSources extends SpecialPage {
         * format and output them
         *
         * @throws MWException
-        * @return string
+        * @return bool
         */
        private function showList() {
                global $wgContLang;
@@ -205,7 +203,8 @@ class SpecialBookSources extends SpecialPage {
                $url = str_replace( '$1', $this->isbn, $url );
 
                return Html::rawElement( 'li', [],
-                       Html::element( 'a', [ 'href' => $url, 'class' => 'external' ], $label ) );
+                       Html::element( 'a', [ 'href' => $url, 'class' => 'external' ], $label )
+               );
        }
 
        protected function getGroupName() {