Improve getUrlDomainDistance() return values
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 3 Nov 2016 04:56:00 +0000 (21:56 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 3 Nov 2016 04:56:00 +0000 (21:56 -0700)
This change is just cosmetic given the caller it has.

Change-Id: I591f92e56d9f5574d032dda380bc03b491b10738

includes/MediaWiki.php

index f21128e..f7e57fc 100644 (file)
@@ -676,14 +676,14 @@ class MediaWiki {
        /**
         * @param string $url
         * @param IContextSource $context
-        * @return string|bool Either "local" or "remote" if in the farm, false otherwise
+        * @return string Either "local", "remote" if in the farm, "external" otherwise
         */
        private static function getUrlDomainDistance( $url, IContextSource $context ) {
                static $relevantKeys = [ 'host' => true, 'port' => true ];
 
                $infoCandidate = wfParseUrl( $url );
                if ( $infoCandidate === false ) {
-                       return false;
+                       return 'external';
                }
 
                $infoCandidate = array_intersect_key( $infoCandidate, $relevantKeys );
@@ -705,7 +705,7 @@ class MediaWiki {
                        }
                }
 
-               return false;
+               return 'external';
        }
 
        /**