Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
AppManagement
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 3
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 isIncludable
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 22
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace MediaWiki\Extension\WikimediaApiPortalOAuth\Special;
4
5use MediaWiki\Html\Html;
6use MediaWiki\SpecialPage\SpecialPage;
7
8/**
9 * Class AppManagement
10 * @package MediaWiki\Extension\WikimediaApiPortalOAuth\Special
11 */
12class AppManagement extends SpecialPage {
13
14    /**
15     * AppManagement constructor.
16     */
17    public function __construct() {
18        parent::__construct( 'AppManagement', 'wikimediaapiportaloauth-manage-oauth' );
19    }
20
21    /**
22     * @inheritDoc
23     */
24    public function isIncludable() {
25        return true;
26    }
27
28    /**
29     * @inheritDoc
30     */
31    public function execute( $subPage ) {
32        parent::execute( $subPage );
33
34        $output = $this->getOutput();
35        $output->disallowUserJs();
36
37        if ( !$this->getUser()->isEmailConfirmed() ) {
38            $output->addHTML(
39                $this->msg( 'wikimediaapiportaloauth-email-not-confirmed' )
40            );
41            return;
42        }
43
44        $output->addHTML(
45            $this->msg( 'wikimediaapiportaloauth-page-introduction' )
46        );
47
48        $output->addModules(
49            'ext.wikimediaapiportaloauth.keyManagement'
50        );
51        $output->addHTML( Html::element( 'div', [
52            'id' => 'api-management-panel'
53        ] ) );
54        $output->addJsConfigVars( [
55            'wgWikimediaApiPortalOAuthMetaRestURL' => $this->getConfig()->get( 'WikimediaApiPortalOAuthMetaRestURL' ),
56            'wgWikimediaApiPortalOAuthMetaApiURL' => $this->getConfig()->get( 'WikimediaApiPortalOAuthMetaApiURL' ),
57            'wgWikimediaApiPortalUserEmail' => $this->getUser()->getEmail()
58        ] );
59    }
60}