3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
22 namespace MediaWiki\Linker
;
27 interface LinkTarget
{
30 * Get the namespace index.
32 * @return int Namespace index
34 public function getNamespace();
37 * Get the link fragment (i.e. the bit after the #) in text form.
39 * @return string link fragment
41 public function getFragment();
44 * Whether the link target has a fragment
48 public function hasFragment();
51 * Get the main part with underscores.
53 * @return string Main part of the link, with underscores (for use in href attributes)
55 public function getDBkey();
58 * Returns the link in text form, without namespace prefix or fragment.
60 * This is computed from the DB key by replacing any underscores with spaces.
64 public function getText();
67 * Creates a new LinkTarget for a different fragment of the same page.
68 * It is expected that the same type of object will be returned, but the
69 * only requirement is that it is a LinkTarget.
71 * @param string $fragment The fragment name, or "" for the entire page.
75 public function createFragmentTarget( $fragment );
78 * Whether this LinkTarget has an interwiki component
82 public function isExternal();
85 * The interwiki component of this LinkTarget
89 public function getInterwiki();