Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| CentralAuthTokenProvider | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| getToken | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace FileImporter\Remote\MediaWiki; |
| 4 | |
| 5 | use MediaWiki\Extension\CentralAuth\CentralAuthServices; |
| 6 | use MediaWiki\Session\SessionManager; |
| 7 | use MediaWiki\User\User; |
| 8 | use MediaWiki\WikiMap\WikiMap; |
| 9 | |
| 10 | /** |
| 11 | * @license GPL-2.0-or-later |
| 12 | */ |
| 13 | class CentralAuthTokenProvider { |
| 14 | |
| 15 | /** |
| 16 | * @return string CentralAuth token. |
| 17 | */ |
| 18 | public function getToken( User $user ) { |
| 19 | // @phan-suppress-next-line PhanUndeclaredClassMethod This method and service exists in CentralAuth. |
| 20 | return CentralAuthServices::getApiTokenManager()->getToken( |
| 21 | $user, |
| 22 | SessionManager::getGlobalSession()->getId(), |
| 23 | WikiMap::getCurrentWikiId() |
| 24 | ); |
| 25 | } |
| 26 | |
| 27 | } |