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
02:41
created

matchesSafelyWithDiagnosticDescription()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
c 0
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
    /**
12
     * @var Matcher|string
13
     */
14
    private $matcher;
15
16
    /**
17
     * @param Matcher|string $text
18
     *
19
     * @return self
20
     */
21
    public static function havingTextContents($text) {
22
        return new static($text);
23
    }
24
25
    /**
26
     * @param Matcher|string $matcher
27
     */
28
    public function __construct($matcher)
29
    {
30
        parent::__construct();
31
        $this->matcher = $matcher;
32
    }
33
34 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...
35
    {
36 2
        $description->appendText('having text contents ');
37 2
        if ($this->matcher instanceof Matcher) {
38
            $description->appendDescriptionOf($this->matcher);
39
        } else {
40 2
            $description->appendValue($this->matcher);
41
        }
42 2
    }
43
44
    /**
45
     * @param \DOMElement $item
46
     * @param Description $mismatchDescription
47
     *
48
     * @return bool
49
     */
50 4
    protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription)
51
    {
52 4
        if ($this->matcher instanceof Matcher) {
53 2
            return $this->matcher->matches($item->textContent);
54
        } else {
55 2
            return $item->textContent === (string)$this->matcher;
56
        }
57
    }
58
59
}
60