Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
SpecialContentTranslationStats
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 5
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
 getDescription
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 initModules
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 addJsConfigVars
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Contains the special page Special:ContentTranslationStats.
4 *
5 * @copyright See AUTHORS.txt
6 * @license GPL-2.0-or-later
7 */
8
9namespace ContentTranslation\Special;
10
11use MutableContext;
12use SpecialPage;
13
14/**
15 * Shows some metrics about ContentTranslation usage.
16 *
17 * @ingroup SpecialPage
18 */
19class SpecialContentTranslationStats extends SpecialPage {
20
21    /**
22     * @var \SkinFactory
23     */
24    private $skinFactory;
25
26    /**
27     * @param \SkinFactory $skinFactory
28     */
29    public function __construct( \SkinFactory $skinFactory ) {
30        parent::__construct( 'ContentTranslationStats' );
31        $this->skinFactory = $skinFactory;
32    }
33
34    final public function execute( $parameters ) {
35        parent::execute( $parameters );
36        // Use custom 'contenttranslation' skin
37        /** @var MutableContext $context */
38        $context = $this->getContext();
39        '@phan-var MutableContext $context';
40        $context->setSkin(
41            $this->skinFactory->makeSkin( 'contenttranslation' )
42        );
43        // Run the extendable chunks from the sub class.
44        $this->initModules();
45        $this->addJsConfigVars();
46    }
47
48    public function getDescription() {
49        return $this->msg( 'cx-stats-title' );
50    }
51
52    protected function initModules() {
53        $this->getOutput()->addModules( 'ext.cx.stats' );
54    }
55
56    protected function addJsConfigVars() {
57        $this->getOutput()->addJsConfigVars(
58            'wgContentTranslationCampaigns',
59            $this->getConfig()->get( 'ContentTranslationCampaigns' )
60        );
61    }
62}