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

Matcher::getUrl()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 10
nc 3
nop 1
crap 3
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