Have Linker::linkUrl() accept LinkTarget
[lhc/web/wiklou.git] / includes / LinkTarget.php
1 <?php
2
3 /**
4 * @author Addshore
5 *
6 * @since 1.27
7 */
8 interface LinkTarget {
9
10 /**
11 * Get the namespace index.
12 *
13 * @return int Namespace index
14 */
15 public function getNamespace();
16
17 /**
18 * Get the link fragment (i.e. the bit after the #) in text form.
19 *
20 * @return string link fragment
21 */
22 public function getFragment();
23
24 /**
25 * Whether the link target has a fragment
26 *
27 * @return bool
28 */
29 public function hasFragment();
30
31 /**
32 * Get the main part with underscores.
33 *
34 * @return string Main part of the link, with underscores (for use in href attributes)
35 */
36 public function getDBkey();
37
38 /**
39 * Returns the link in text form, without namespace prefix or fragment.
40 *
41 * This is computed from the DB key by replacing any underscores with spaces.
42 *
43 * @return string
44 */
45 public function getText();
46
47 /**
48 * Creates a new LinkTarget for a different fragment of the same page.
49 * It is expected that the same type of object will be returned, but the
50 * only requirement is that it is a LinkTarget.
51 *
52 * @param string $fragment The fragment name, or "" for the entire page.
53 *
54 * @return LinkTarget
55 */
56 public function createFragmentTarget( $fragment );
57 }