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
Pull Request — master (#64)
by Norbert
01:38
created

PHPMatcher::createMatcher()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 11
rs 9.4285
cc 2
eloc 6
nc 2
nop 0
1
<?php
2
3
namespace Coduo\PHPMatcher;
4
5
use Coduo\PHPMatcher\Factory\SimpleFactory;
6
7
final class PHPMatcher
8
{
9
    /**
10
     * @var Matcher|null
11
     */
12
    private static $matcher;
13
14
    /**
15
     * @param $value
16
     * @param $pattern
17
     * @return bool
18
     */
19
    public static function match($value, $pattern)
20
    {
21
        $matcher = self::createMatcher();
22
     
23
        return $matcher->match($value, $pattern);
24
    }
25
26
    /**
27
     * @return null|string
28
     */
29
    public static function getError()
30
    {
31
        $matcher = self::createMatcher();
32
        
33
        return $matcher->getError();
34
    }
35
    
36
    private static function createMatcher()
37
    {
38
        if (self::$matcher instanceof Matcher) {
39
            return self::$matcher;
40
        }
41
        
42
        $factory = new SimpleFactory();
43
        self::$matcher = $factory->createMatcher();
44
        
45
        return self::$matcher;
46
    }
47
}