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 ( 14e86b...9d5c74 )
by Gilles
02:13
created

Matcher::_parseWildcard()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PHPFunctional\PatternMatching;
4
5
class Matcher
6
{
7
    protected static function parser() {
8
        static $parser = null;
9
10
        if(is_null($parser)) {
11
            $parser = new Parser();
12
        }
13
14
        return $parser;
15
    }
16
17
    /**
18
     * @param mixed $value
19 4
     * @param array $patterns
20
     * @return mixed
21
     */
22
    public static function match($value, array $patterns)
23
    {
24 4
        foreach($patterns as $pattern => $callback) {
25 4
            $match = static::parser()->parse($value, $pattern);
26
27
            if($match !== false) {
28
                return is_callable($callback) ?
29
                    call_user_func_array($callback, $match) :
30 4
                    $callback;
31
            }
32
        }
33
34
        throw new \RuntimeException('Non-exhaustive patterns.');
35
    }
36
}