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 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
CodeTagListView
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 execute
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
 linkCallback
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\Extension\CodeReview\UI;
4
5use Html;
6use SpecialPage;
7
8/**
9 * Special:Code/MediaWiki/tag
10 */
11class CodeTagListView extends CodeView {
12    public function execute() {
13        global $wgOut;
14        $list = $this->mRepo->getTagList( true );
15
16        if ( count( $list ) === 0 ) {
17            $wgOut->addWikiMsg( 'code-tags-no-tags' );
18        } else {
19            # Show a cloud made of tags
20            $tc = new WordCloud( $list, [ $this, 'linkCallback' ] );
21            $wgOut->addHTML( $tc->getCloudHtml() );
22        }
23    }
24
25    public function linkCallback( $tag, $weight ) {
26        $query = $this->mRepo->getName() . '/tag/' . $tag;
27        return Html::element( 'a', [
28            'href' => SpecialPage::getTitleFor( 'Code', $query )->getFullURL(),
29            'class' => 'plainlinks mw-wordcloud-size-' . $weight ], $tag ) . "\n";
30    }
31}