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 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
ApiQueryContentTranslationStats
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 3
12
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
 execute
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
 getExamplesMessages
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Api module for querying Content translations for stats.
4 *
5 * @copyright See AUTHORS.txt
6 * @license GPL-2.0-or-later
7 */
8
9namespace ContentTranslation\ActionApi;
10
11use ApiQueryBase;
12use ContentTranslation\Translation;
13use ContentTranslation\Translator;
14
15/**
16 * Api module for querying ContentTranslation stats.
17 */
18class ApiQueryContentTranslationStats extends ApiQueryBase {
19
20    public function __construct( $query, $moduleName ) {
21        parent::__construct( $query, $moduleName );
22    }
23
24    public function execute() {
25        $result = $this->getResult();
26        $result->addValue(
27            [ 'query', 'contenttranslationstats' ],
28            'pages',
29            Translation::getStats()
30        );
31        $result->addValue(
32            [ 'query', 'contenttranslationstats' ],
33            'translators',
34            Translator::getStats()
35        );
36    }
37
38    protected function getExamplesMessages() {
39        return [
40            'action=query&list=contenttranslationstats' =>
41                'apihelp-query+contenttranslationstats-example-1',
42        ];
43    }
44}