GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PersonalTools   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 8.82 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 3
loc 34
rs 10
c 0
b 0
f 0
ccs 14
cts 14
cp 1
wmc 2
lcom 1
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
B getHtml() 3 25 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * File holding the PersonalTools class
4
 *
5
 * This file is part of the MediaWiki skin Chameleon.
6
 *
7
 * @copyright 2013 - 2014, Stephan Gambke
8
 * @license   GNU General Public License, version 3 (or any later version)
9
 *
10
 * The Chameleon skin is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by the Free
12
 * Software Foundation, either version 3 of the License, or (at your option) any
13
 * later version.
14
 *
15
 * The Chameleon skin is distributed in the hope that it will be useful, but
16
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18
 * details.
19
 *
20
 * You should have received a copy of the GNU General Public License along
21
 * with this program. If not, see <http://www.gnu.org/licenses/>.
22
 *
23
 * @file
24
 * @ingroup   Skins
25
 */
26
27
namespace Skins\Chameleon\Components;
28
29
/**
30
 * The PersonalTools class.
31
 *
32
 * An unordered list of personal tools: <ul id="p-personal" >...
33
 *
34
 * @author Stephan Gambke
35
 * @since 1.0
36
 * @ingroup Skins
37
 */
38
class PersonalTools extends Component {
39
40
	/**
41
	 * Builds the HTML code for this component
42
	 *
43
	 * @return String the HTML code
44
	 */
45 7
	public function getHtml() {
46
47 7
		$ret = $this->indent() . '<!-- personal tools -->' .
48 7
			   $this->indent() . '<div class="p-personal ' . $this->getClassString() . '" id="p-personal" >';
49
50
		// include message to a user about new messages on their talkpage
51
		// TODO: make including the NewTalkNotifier dependent on an option (PREPEND, APPEND, OFF)
52 7
		$newtalkNotifier = new NewtalkNotifier( $this->getSkinTemplate(), null, $this->getIndent() + 2 );
53
54 7
		$ret .= $this->indent( 1 ) . '<ul class="p-personal-tools list-inline pull-right" >';
55
56 7
		$this->indent( 1 );
57
58
		// add personal tools (links to user page, user talk, prefs, ...)
59 7 View Code Duplication
		foreach ( $this->getSkinTemplate()->getPersonalTools() as $key => $item ) {
60 7
			$ret .= $this->indent() . $this->getSkinTemplate()->makeListItem( $key, $item );
61 7
		}
62
63 7
		$ret .= $this->indent( -1 ) . '</ul>' .
64 7
				$this->indent() . '<div class="newtalk-notifier">' . $newtalkNotifier->getHtml() .
65 7
				$this->indent() . '</div>' .
66 7
				$this->indent( -1 ) . '</div>' . "\n";
67
68 7
		return $ret;
69
	}
70
71
}
72