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

Matcher::transformRoute()   B

Complexity

Conditions 4
Paths 2

Size

Total Lines 26
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 13
cts 13
cp 1
rs 8.5806
c 0
b 0
f 0
cc 4
eloc 17
nc 2
nop 1
crap 4
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