Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
RedirectTarget | |
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getLink | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\EventBus\Redirects; |
4 | |
5 | use MediaWiki\Linker\LinkTarget; |
6 | use MediaWiki\Page\PageIdentity; |
7 | use MediaWiki\Page\PageReference; |
8 | |
9 | /** |
10 | * Tuple representing a redirect target. |
11 | * |
12 | * Holds at least a {@link LinkTarget}. The page representation is optional and… |
13 | * |
14 | * * …may be a {@link PageIdentity} if the target is a page in the same wiki as the source |
15 | * then, will be returned. |
16 | * * …may be a {@link PageReference} if the target is a special page |
17 | * * …may be `null` if the target lies outside the source wiki, for example, |
18 | * {@link https://en.wikipedia.org/wiki/Help:Interwiki_linking interwiki links}, or |
19 | * in general {@link https://en.wikipedia.org/wiki/Wikipedia:External_links external links} |
20 | */ |
21 | class RedirectTarget { |
22 | |
23 | /** |
24 | * @var LinkTarget |
25 | */ |
26 | private LinkTarget $link; |
27 | |
28 | /** |
29 | * @var PageReference|PageIdentity|null |
30 | */ |
31 | private ?PageReference $page; |
32 | |
33 | public function __construct( LinkTarget $link, ?PageReference $page = null ) { |
34 | $this->link = $link; |
35 | $this->page = $page; |
36 | } |
37 | |
38 | /** |
39 | * @return LinkTarget |
40 | */ |
41 | public function getLink(): LinkTarget { |
42 | return $this->link; |
43 | } |
44 | |
45 | /** |
46 | * @return PageReference|PageIdentity|null |
47 | */ |
48 | public function getPage(): ?PageReference { |
49 | return $this->page; |
50 | } |
51 | } |