Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
ScoreVeConfig
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 makeScript
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
6
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}