MediaWiki REL1_39
LinkTarget.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Linker;
22
26interface LinkTarget {
27
34 public function getNamespace(): int;
35
43 public function inNamespace( int $ns ): bool;
44
51 public function getFragment(): string;
52
59 public function hasFragment(): bool;
60
71 public function getDBkey(): string;
72
87 public function getText(): string;
88
99 public function createFragmentTarget( string $fragment );
100
107 public function isExternal(): bool;
108
115 public function getInterwiki(): string;
116
127 public function isSameLinkAs( LinkTarget $other ): bool;
128
135 public function __toString(): string;
136
137}
inNamespace(int $ns)
Convenience function to check if the target is in a given namespace.
getInterwiki()
The interwiki component of this LinkTarget.
hasFragment()
Whether the link target has a fragment.
__toString()
Return an informative human-readable representation of the link target, for use in logging and debugg...
getFragment()
Get the link fragment in text form (i.e.
getNamespace()
Get the namespace index.
getDBkey()
Get the main part of the link target, in canonical database form.
isExternal()
Whether this LinkTarget has an interwiki component.
getText()
Get the main part of the link target, in text form.
isSameLinkAs(LinkTarget $other)
Check whether the given LinkTarget refers to the same target as this LinkTarget.
createFragmentTarget(string $fragment)
Create a new LinkTarget with a different fragment on the same page.