Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
PagequalityTagParser
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
30
0.00% covered (danger)
0.00%
0 / 1
 render
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
30
1<?php
2
3namespace ProofreadPage\Parser;
4
5use MediaWiki\Html\Html;
6
7/**
8 * @license GPL-2.0-or-later
9 *
10 * Parser for the <pagequality> tag
11 */
12class PagequalityTagParser {
13
14    /**
15     * Render a <pagequality> tag
16     *
17     * @param array $args tags arguments
18     * @return string
19     */
20    public function render( array $args ) {
21        if ( !array_key_exists( 'level', $args ) || !is_numeric( $args['level'] ) ||
22            $args['level'] < 0 || $args['level'] > 4
23        ) {
24            return '';
25        }
26
27        return Html::openElement( 'div',
28            [ 'class' => 'prp-page-qualityheader quality' . $args['level'] ] ) .
29            wfMessage( 'proofreadpage_quality' . $args['level'] . '_message' )
30                ->inContentLanguage()->parse() .
31            Html::closeElement( 'div' );
32    }
33}