Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 25
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
CodeAuthorListView
0.00% covered (danger)
0.00%
0 / 25
0.00% covered (danger)
0.00%
0 / 2
30
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 / 24
0.00% covered (danger)
0.00%
0 / 1
20
1<?php
2
3namespace MediaWiki\Extension\CodeReview\UI;
4
5/**
6 * Special:Code/MediaWiki/author
7 */
8class CodeAuthorListView extends CodeView {
9    public function __construct( $repo ) {
10        parent::__construct( $repo );
11    }
12
13    public function execute() {
14        global $wgOut, $wgLang;
15
16        $authors = $this->mRepo->getAuthorList();
17        $repo = $this->mRepo->getName();
18        $text = wfMessage( 'code-authors-text' )->text() . "\n\n";
19        $text .= '<strong>' . wfMessage( 'code-author-total' )
20            ->numParams( $this->mRepo->getAuthorCount() )->text() . "</strong>\n";
21
22        $wgOut->addWikiTextAsInterface( $text );
23
24        $wgOut->addHTML( '<table class="wikitable">'
25                . '<tr><th>' . wfMessage( 'code-field-author' )->escaped()
26                . '</th><th>' . wfMessage( 'code-author-lastcommit' )->escaped() . '</th></tr>' );
27
28        foreach ( $authors as $committer ) {
29            if ( $committer ) {
30                $wgOut->addHTML( '<tr><td>' );
31                $author = $committer['author'];
32                $text = "[[Special:Code/$repo/author/$author|$author]]";
33                $user = $this->mRepo->authorWikiUser( $author );
34                if ( $user ) {
35                    $title = htmlspecialchars( $user->getUserPage()->getPrefixedText() );
36                    $name = htmlspecialchars( $user->getName() );
37                    $text .= " ([[$title|$name]])";
38                }
39                $wgOut->addWikiTextAsInterface( $text );
40                $timeDate = htmlspecialchars( $wgLang->timeanddate( $committer['lastcommit'], true ) );
41                $wgOut->addHTML(
42                    "</td><td>{$timeDate}</td></tr>"
43                );
44            }
45        }
46
47        $wgOut->addHTML( '</table>' );
48    }
49}