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.
Completed
Push — master ( 17d35c...8ee10e )
by
unknown
05:54
created

Logo::addLink()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 2
eloc 2
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * File holding the Logo class
4
 *
5
 * This file is part of the MediaWiki skin Chameleon.
6
 *
7
 * @copyright 2013 - 2015, 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
use Linker;
30
use Skins\Chameleon\IdRegistry;
31
32
/**
33
 * The Logo class.
34
 *
35
 * The logo image as a link to the wiki main page wrapped in a div: <div id="p-logo" role="banner">
36
 *
37
 * @author Stephan Gambke
38
 * @since 1.0
39
 * @ingroup Skins
40
 */
41
class Logo extends Component {
42
43
	/**
44
	 * Builds the HTML code for this component
45
	 *
46
	 * @return String the HTML code
47
	 */
48 7
	public function getHtml() {
49
50 7
		$attribs = NULL;
51 7
		if( $this->addLink() ) {
52 1
			$attribs  = array_merge(
53 1
				array( 'href' => $this->getSkinTemplate()->data[ 'nav_urls' ][ 'mainpage' ][ 'href' ] ),
54 1
				Linker::tooltipAndAccesskeyAttribs( 'p-logo' )
55 1
			);
56 1
		}
57
58 7
		$contents = \Html::element( 'img',
59
			array(
60 7
				'src' => $this->getSkinTemplate()->data[ 'logopath' ],
61 7
				'alt' => $this->getSkinTemplate()->data[ 'sitename' ],
62
			)
63 7
		);
64
65
		return
66 7
			$this->indent() . '<!-- logo and main page link -->' .
67 7
			$this->indent() . \Html::openElement( 'div',
68
				array(
69 7
					'id'    => IdRegistry::getRegistry()->getId( 'p-logo' ),
70 7
					'class' => 'p-logo ' . $this->getClassString(),
71
					'role'  => 'banner'
72 7
				)
73 7
			) .
74 7
			$this->indent( 1 ) . \Html::rawElement( 'a', $attribs, $contents ) .
75 7
			$this->indent( -1 ) . '</div>' . "\n";
76
	}
77
78
	/**
79
	 * Return true if addLink attribute is set to yes in Logo component and clicking on logo
80
	 * should redirect to Main Page, and false if not
81
	 *
82
	 * @return bool
83
	 */
84 7
	private function addLink() {
85 7
		return $this->getDomElement() !== null && filter_var( $this->getDomElement()->getAttribute( 'addLink' ), FILTER_VALIDATE_BOOLEAN );
86
	}
87
}
88