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 ( 114669...8709d9 )
by Norbert
02:06
created

PHPMatcherConstraint::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Coduo\PHPMatcher\PHPUnit;
4
5
use Coduo\PHPMatcher\Factory\SimpleFactory;
6
use Coduo\PHPMatcher\Matcher;
7
8
final class PHPMatcherConstraint extends \PHPUnit_Framework_Constraint
9
{
10
    /**
11
     * @var string
12
     */
13
    private $pattern;
14
15
    /**
16
     * @var Matcher
17
     */
18
    private $matcher;
19
20
    /**
21
     * @param string $pattern
22
     */
23
    public function __construct($pattern)
24
    {
25
        parent::__construct();
26
27
        $this->pattern = $pattern;
28
        $this->matcher = $this->createMatcher();
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function toString()
35
    {
36
        return 'matches the pattern';
37
    }
38
39
    /**
40
     * @param mixed $other
41
     *
42
     * @return null|string
43
     */
44
    protected function additionalFailureDescription($other)
45
    {
46
        return $this->matcher->getError();
47
    }
48
49
    /**
50
     * @param mixed $value
51
     *
52
     * @return bool
53
     */
54
    protected function matches($value)
55
    {
56
        return $this->matcher->match($value, $this->pattern);
57
    }
58
59
    /**
60
     * @return Matcher
61
     */
62
    private function createMatcher()
63
    {
64
        $factory = new SimpleFactory();
65
66
        return $factory->createMatcher();
67
    }
68
}