MediaWiki  master
LinkTarget.php
Go to the documentation of this file.
1 <?php
21 namespace MediaWiki\Linker;
22 
30 interface LinkTarget {
31 
38  public function getNamespace(): int;
39 
47  public function inNamespace( int $ns ): bool;
48 
55  public function getFragment(): string;
56 
63  public function hasFragment(): bool;
64 
75  public function getDBkey(): string;
76 
91  public function getText(): string;
92 
103  public function createFragmentTarget( string $fragment );
104 
111  public function isExternal(): bool;
112 
119  public function getInterwiki(): string;
120 
131  public function isSameLinkAs( LinkTarget $other ): bool;
132 
139  public function __toString(): string;
140 
141 }
Represents the target of a wiki link.
Definition: LinkTarget.php:30
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.