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.

Matcher   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 7
eloc 15
c 2
b 0
f 0
dl 0
loc 50
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A match() 0 27 6
1
<?php
2
declare(strict_types=1);
3
4
namespace Meraki\Route;
5
6
use Meraki\Route\Collector;
0 ignored issues
show
Bug introduced by
The type Meraki\Route\Collector was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Psr\Http\Message\ServerRequestInterface as ServerRequest;
8
use Meraki\Route\Rule;
9
use Meraki\Route\Exception\RequestTargetNotMatched;
10
use Meraki\Route\Exception\MethodNotMatched;
11
12
/**
13
 * Cycles through a route group yielding any route rules that match the request.
14
 */
15
final class Matcher
16
{
17
    /**
18
     * @var Collection [$rules description]
19
     */
20
    private $rules;
21
22
    /**
23
     * [__construct description]
24
     *
25
     * @param Collection $rules [description]
26
     */
27
    public function __construct(Collection $rules)
28
    {
29
        $this->rules = $rules;
30
    }
31
32
    /**
33
     * [match description]
34
     *
35
     * @param ServerRequest $request [description]
36
     * @return MatchResult [description]
37
     */
38
    public function match(ServerRequest $request): MatchResult
39
    {
40
        $matchedRules = [];
41
        $allowedMethods = [];
42
43
        // check for rules that matches the request-target
44
        foreach ($this->rules as $rule) {
45
            if ($rule->getPattern()->matches($request->getRequestTarget())) {
46
                $matchedRules[] = $rule;
47
            }
48
        }
49
50
        // else, 404
51
        if (empty($matchedRules)) {
52
            return MatchResult::requestTargetNotMatched($request);
53
        }
54
55
        // make sure rule matches method used and build 'allowed methods' in case of 405
56
        foreach ($matchedRules as $matchedRule) {
57
            $allowedMethods[] = $matchedRule->getMethod();
58
59
            if ($matchedRule->matchesMethod($request->getMethod())) {
60
            	return MatchResult::matched($request, $matchedRule);
61
            }
62
        }
63
64
        return MatchResult::methodNotMatched($request, $allowedMethods);
65
    }
66
}
67