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.

Code Duplication    Length = 46-46 lines in 3 locations

src/Matcher/DoubleMatcher.php 1 location

@@ 8-53 (lines=46) @@
5
use Coduo\PHPMatcher\Parser;
6
use Coduo\ToString\StringConverter;
7
8
final class DoubleMatcher extends Matcher
9
{
10
    /**
11
     * @var Parser
12
     */
13
    private $parser;
14
15
    /**
16
     * @param Parser $parser
17
     */
18
    public function __construct(Parser $parser)
19
    {
20
        $this->parser = $parser;
21
    }
22
23
    /**
24
     * {@inheritDoc}
25
     */
26
    public function match($value, $pattern)
27
    {
28
        if (!is_double($value)) {
29
            $this->error = sprintf("%s \"%s\" is not a valid double.", gettype($value), new StringConverter($value));
30
            return false;
31
        }
32
33
        $typePattern = $this->parser->parse($pattern);
34
        if (!$typePattern->matchExpanders($value)) {
35
            $this->error = $typePattern->getError();
36
            return false;
37
        }
38
39
        return true;
40
    }
41
42
    /**
43
     * {@inheritDoc}
44
     */
45
    public function canMatch($pattern)
46
    {
47
        if (!is_string($pattern)) {
48
            return false;
49
        }
50
51
        return $this->parser->hasValidSyntax($pattern) && $this->parser->parse($pattern)->is('double');
52
    }
53
}
54

src/Matcher/IntegerMatcher.php 1 location

@@ 8-53 (lines=46) @@
5
use Coduo\PHPMatcher\Parser;
6
use Coduo\ToString\StringConverter;
7
8
final class IntegerMatcher extends Matcher
9
{
10
    /**
11
     * @var Parser
12
     */
13
    private $parser;
14
15
    /**
16
     * @param Parser $parser
17
     */
18
    public function __construct(Parser $parser)
19
    {
20
        $this->parser = $parser;
21
    }
22
23
    /**
24
     * {@inheritDoc}
25
     */
26
    public function match($value, $pattern)
27
    {
28
        if (!is_integer($value)) {
29
            $this->error = sprintf("%s \"%s\" is not a valid integer.", gettype($value), new StringConverter($value));
30
            return false;
31
        }
32
33
        $typePattern = $this->parser->parse($pattern);
34
        if (!$typePattern->matchExpanders($value)) {
35
            $this->error = $typePattern->getError();
36
            return false;
37
        }
38
39
        return true;
40
    }
41
42
    /**
43
     * {@inheritDoc}
44
     */
45
    public function canMatch($pattern)
46
    {
47
        if (!is_string($pattern)) {
48
            return false;
49
        }
50
51
        return $this->parser->hasValidSyntax($pattern) && $this->parser->parse($pattern)->is('integer');
52
    }
53
}
54

src/Matcher/StringMatcher.php 1 location

@@ 8-53 (lines=46) @@
5
use Coduo\PHPMatcher\Parser;
6
use Coduo\ToString\StringConverter;
7
8
final class StringMatcher extends Matcher
9
{
10
    /**
11
     * @var Parser
12
     */
13
    private $parser;
14
15
    /**
16
     * @param Parser $parser
17
     */
18
    public function __construct(Parser $parser)
19
    {
20
        $this->parser = $parser;
21
    }
22
23
    /**
24
     * {@inheritDoc}
25
     */
26
    public function match($value, $pattern)
27
    {
28
        if (!is_string($value)) {
29
            $this->error = sprintf("%s \"%s\" is not a valid string.", gettype($value), new StringConverter($value));
30
            return false;
31
        }
32
33
        $typePattern = $this->parser->parse($pattern);
34
        if (!$typePattern->matchExpanders($value)) {
35
            $this->error = $typePattern->getError();
36
            return false;
37
        }
38
39
        return true;
40
    }
41
42
    /**
43
     * {@inheritDoc}
44
     */
45
    public function canMatch($pattern)
46
    {
47
        if (!is_string($pattern)) {
48
            return false;
49
        }
50
51
        return $this->parser->hasValidSyntax($pattern) && $this->parser->parse($pattern)->is('string');
52
    }
53
}
54