Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
CRAP | |
62.50% |
5 / 8 |
SpecialPageOAuthUrl | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
3.47 | |
62.50% |
5 / 8 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getValue | |
0.00% |
0 / 1 |
2.50 | |
50.00% |
3 / 6 |
<?php | |
namespace MediaWiki\Extension\WikibaseManifest; | |
use MediaWiki\Extension\OAuth\Backend\Utils; | |
use MediaWiki\Extension\OAuth\Frontend\SpecialPages\SpecialMWOAuthConsumerRegistration; | |
use WikiMap; | |
class SpecialPageOAuthUrl implements OAuthUrl { | |
private $specialPage; | |
public function __construct( SpecialMWOAuthConsumerRegistration $specialPage = null ) { | |
$this->specialPage = $specialPage; | |
} | |
public function getValue(): string { | |
global $wgMWOAuthCentralWiki; | |
if ( Utils::isCentralWiki() ) { | |
$url = $this->specialPage->getPageTitle()->getFullURL(); | |
} else { | |
$url = WikiMap::getForeignURL( | |
$wgMWOAuthCentralWiki, | |
'Special:OAuthConsumerRegistration' | |
); | |
} | |
return $url; | |
} | |
} |