Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ScoreVeConfig
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 makeScript
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3namespace MediaWiki\Extension\Score;
4
5use MediaWiki\MediaWikiServices;
6use MediaWiki\ResourceLoader as RL;
7
8class ScoreVeConfig {
9
10    /**
11     * @param RL\Context $context
12     * @return string JavaScript code
13     */
14    public static function makeScript( RL\Context $context ) {
15        $utils = MediaWikiServices::getInstance()->getLanguageNameUtils();
16        $supportedLangs = [];
17        foreach ( Score::SUPPORTED_NOTE_LANGUAGES as $lilyName => $code ) {
18            $supportedLangs[$lilyName] = $utils->getLanguageName( $code );
19        }
20        return 'mw.config.set('
21            . $context->encodeJson( [ 'wgScoreNoteLanguages' => $supportedLangs ] )
22            . ');';
23    }
24}