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.

TagNameMatcher::withTagName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace WMDE\HamcrestHtml;
4
5
use Hamcrest\Description;
6
use Hamcrest\Matcher;
7
use Hamcrest\Util;
8
9
class TagNameMatcher extends TagMatcher {
10
11
	/**
12
	 * @var Matcher
13
	 */
14
	private $tagNameMatcher;
15
16
	/**
17
	 * @param Matcher|string $tagName
18
	 *
19
	 * @return self
20
	 */
21
	public static function withTagName( $tagName ) {
22
		return new static( Util::wrapValueWithIsEqual( $tagName ) );
23
	}
24
25
	public function __construct( Matcher $tagNameMatcher ) {
26
		parent::__construct();
27
		$this->tagNameMatcher = $tagNameMatcher;
28
	}
29
30 5
	public function describeTo( Description $description ) {
31 5
		$description->appendText( 'with tag name ' )
32 5
			->appendDescriptionOf( $this->tagNameMatcher );
33 5
	}
34
35
	/**
36
	 * @param \DOMElement $item
37
	 * @param Description $mismatchDescription
38
	 *
39
	 * @return bool
40
	 */
41 11
	protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) {
42 11
		if ( $this->tagNameMatcher->matches( $item->tagName ) ) {
43 6
			return true;
44
		}
45
46 8
		$mismatchDescription->appendText( 'tag name ' );
47 8
		$this->tagNameMatcher->describeMismatch( $item->tagName, $mismatchDescription );
48 8
		return false;
49
	}
50
51
}
52