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   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 41
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A match() 0 6 1
A getError() 0 6 1
A createMatcher() 0 11 2
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
}