'IPSet' => __DIR__ . '/includes/compat/IPSetCompat.php',
'IPTC' => __DIR__ . '/includes/media/IPTC.php',
'IRCColourfulRCFeedFormatter' => __DIR__ . '/includes/rcfeed/IRCColourfulRCFeedFormatter.php',
+ 'LinkTarget' => __DIR__ . '/includes/LinkTarget.php',
'IcuCollation' => __DIR__ . '/includes/Collation.php',
'IdentityCollation' => __DIR__ . '/includes/Collation.php',
'ImageBuilder' => __DIR__ . '/maintenance/rebuildImages.php',
--- /dev/null
+<?php
+
+/**
+ * @author Addshore
+ *
+ * @since 1.27
+ */
+interface LinkTarget {
+
+ /**
+ * Get the namespace index
+ *
+ * @return int Namespace index
+ */
+ public function getNamespace();
+
+ /**
+ * Get the link fragment (i.e.\ the bit after the #) in text form
+ *
+ * @return string link fragment
+ */
+ public function getFragment();
+
+ /**
+ * Get the main part with underscores
+ *
+ * @return string Main part of the link, with underscores (for use in hrf attributes)
+ */
+ public function getDBkey();
+
+ /**
+ * Returns the link in text form,
+ * without namespace prefix or fragment.
+ *
+ * This is computed from the DB key by replacing any underscores with spaces.
+ *
+ * @return string
+ */
+ public function getText();
+
+}
* @note Consider using a TitleValue object instead. TitleValue is more lightweight
* and does not rely on global state or the database.
*/
-class Title {
+class Title implements LinkTarget {
/** @var HashBagOStuff */
static private $titleCache = null;
* @see https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue
* @since 1.23
*/
-class TitleValue {
+class TitleValue implements LinkTarget {
/**
* @var int
*/