Add LinkTarget::hasFragment() helper function
[lhc/web/wiklou.git] / includes / title / TitleValue.php
index a0f3b6f..18a06ea 100644 (file)
@@ -35,7 +35,7 @@ use Wikimedia\Assert\Assert;
  * @see https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue
  * @since 1.23
  */
-class TitleValue {
+class TitleValue implements LinkTarget {
        /**
         * @var int
         */
@@ -95,6 +95,14 @@ class TitleValue {
                return $this->fragment;
        }
 
+       /**
+        * @since 1.27
+        * @return bool
+        */
+       public function hasFragment() {
+               return $this->fragment !== '';
+       }
+
        /**
         * Returns the title's DB key, as supplied to the constructor,
         * without namespace prefix or fragment.