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.
Passed
Pull Request — master (#9)
by no
09:19
created

TextContentsMatcher::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace WMDE\HamcrestHtml;
4
5
use Hamcrest\Description;
6
use Hamcrest\Matcher;
7
8
class TextContentsMatcher extends TagMatcher {
9
10
	/**
11
	 * @var Matcher|string
12
	 */
13
	private $matcher;
14
15
	/**
16
	 * @param Matcher|string $text
17
	 *
18
	 * @return self
19
	 */
20
	public static function havingTextContents( $text ) {
21
		return new static( $text );
22
	}
23
24
	/**
25
	 * @param Matcher|string $matcher
26
	 */
27
	public function __construct( $matcher ) {
28
		parent::__construct();
29
		$this->matcher = $matcher;
30
	}
31
32 2 View Code Duplication
	public function describeTo( Description $description ) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33 2
		$description->appendText( 'having text contents ' );
34 2
		if ( $this->matcher instanceof Matcher ) {
35
			$description->appendDescriptionOf( $this->matcher );
36
		} else {
37 2
			$description->appendValue( $this->matcher );
38
		}
39 2
	}
40
41
	/**
42
	 * @param \DOMElement $item
43
	 * @param Description $mismatchDescription
44
	 *
45
	 * @return bool
46
	 */
47 4
	protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) {
48 4
		if ( $this->matcher instanceof Matcher ) {
49 2
			return $this->matcher->matches( $item->textContent );
50
		} else {
51 2
			return $item->textContent === (string)$this->matcher;
52
		}
53
	}
54
55
}
56