Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
50.00% |
4 / 8 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
SpecialPageOAuthUrl | |
50.00% |
4 / 8 |
|
50.00% |
1 / 2 |
4.12 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getValue | |
42.86% |
3 / 7 |
|
0.00% |
0 / 1 |
2.75 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\WikibaseManifest; |
4 | |
5 | use MediaWiki\Extension\OAuth\Backend\Utils; |
6 | use MediaWiki\Extension\OAuth\Frontend\SpecialPages\SpecialMWOAuthConsumerRegistration; |
7 | use WikiMap; |
8 | |
9 | class SpecialPageOAuthUrl implements OAuthUrl { |
10 | |
11 | private $specialPage; |
12 | |
13 | public function __construct( SpecialMWOAuthConsumerRegistration $specialPage = null ) { |
14 | $this->specialPage = $specialPage; |
15 | } |
16 | |
17 | public function getValue(): string { |
18 | global $wgMWOAuthCentralWiki; |
19 | if ( Utils::isCentralWiki() ) { |
20 | $url = $this->specialPage->getPageTitle()->getFullURL(); |
21 | } else { |
22 | $url = WikiMap::getForeignURL( |
23 | $wgMWOAuthCentralWiki, |
24 | 'Special:OAuthConsumerRegistration' |
25 | ); |
26 | } |
27 | return $url; |
28 | } |
29 | } |