Test Failed
Push — master ( ebba22...0aa43a )
by Enrico
02:58
created

RouteMatcher::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace uSILEX;
3
4
5
Class RouteMatcher implements RouteMatcherInterface
6
{
7
    protected $app;
8
    
9 2
    public function __construct( Application $app) 
10
    {    
11 2
        $this->app = $app;
12 2
    }
13
14
    
15 2
    public function match(Route $route) : array 
16
    {
17 2
        assert( isset($this->app['request']));
18
        
19 2
        $verbRegexp= '#^' . $route->getHttpVerb() . '$#i'; // case insensitive
20 2
        $pathRegexp= '#^' . $route->getPath() . '$#'; // case sensitive
21
        
22
        $matches = null;
23
        try {
24 2
            preg_match($verbRegexp, $this->app['request']->getMethod()) &&
25
            preg_match($pathRegexp, $this->app['request']->getPathInfo(),$matches);
26 2
        } catch (Exception $e) {// just ignore regexp errors...}
27 2
        
28
        return $matches;
29
    }
30
}
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected EOF, expecting T_FUNCTION or T_CONST on line 30 at column 0
Loading history...