Passed
Branch master (32ad63)
by Bohuslav
02:06
created

Matcher::getMatchRoute()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 11
nc 4
nop 2
crap 5
1
<?php
2
declare(strict_types=1);
3
4
namespace Kambo\Router;
5
6
// \Psr\Http\Message
7
use Psr\Http\Message\ServerRequestInterface as ServerRequest;
8
9
/**
10
 * Match provided request object with all defined routes in route collection.
11
 * If some of routes match a data in provided request An instance of matched
12
 * parsed route is returned. If nothing is matched false value is returned.
13
 *
14
 * @package Kambo\Router
15
 * @author  Bohuslav Simek <[email protected]>
16
 * @license MIT
17
 */
18
interface Matcher
19
{
20
    /**
21
     * Match request with provided routes.
22
     * Get method and url from provided request and start matching.
23
     *
24
     * @param ServerRequest $request instance of PSR 7 compatible request object
25
     *
26
     * @return mixed
27
     */
28
    public function matchRequest(ServerRequest $request);
29
30
    /**
31
     * Match url and method with provided routes.
32
     *
33
     * @param string $method http method
34
     * @param string $url    url
35
     *
36
     * @return mixed
37
     */
38
    public function matchPathAndMethod(string $method, string $url);
39
}
40