Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
CodeStatusListView
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 execute
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace MediaWiki\Extension\CodeReview\UI;
4
5use MediaWiki\Extension\CodeReview\Backend\CodeRevision;
6use SpecialPage;
7
8/**
9 * Special:Code/MediaWiki/status
10 */
11class CodeStatusListView extends CodeView {
12    public function execute() {
13        global $wgOut;
14
15        $name = $this->mRepo->getName();
16        $states = CodeRevision::getPossibleStates();
17        $wgOut->wrapWikiMsg( "== $1 ==", 'code-field-status' );
18
19        $linkRenderer = \MediaWiki\MediaWikiServices::getInstance()->getLinkRenderer();
20        $tableRows = '';
21        foreach ( $states as $state ) {
22            // Give grep a chance to find the usages:
23            // code-status-new, code-status-fixme, code-status-reverted, code-status-resolved,
24            // code-status-ok, code-status-deferred, code-status-old
25            $link = $linkRenderer->makeLink(
26                SpecialPage::getTitleFor( 'Code', $name . "/status/$state" ),
27                wfMessage( 'code-status-' . $state )->text()
28            );
29            // Give grep a chance to find the usages:
30            // code-status-desc-new, code-status-desc-fixme, code-status-desc-reverted,
31            // code-status-desc-resolved, code-status-desc-ok, code-status-desc-deferred,
32            // code-status-desc-old
33            $tableRows .= "<tr><td class=\"mw-codereview-status-$state\">$link</td>"
34                . '<td>' . wfMessage( 'code-status-desc-' . $state )->escaped() . "</td></tr>\n";
35        }
36        $wgOut->addHTML( '<table class="wikitable">'
37            . '<tr><th>' . wfMessage( 'code-field-status' )->escaped() . '</th>'
38            . '<th>' . wfMessage( 'code-field-status-description' )->escaped() . '</th></tr>'
39            . $tableRows
40            . '</table>'
41        );
42    }
43}