Completed
Push — master ( 35c1c3...0dd52b )
by Dawid
10s
created

Route::getAttributes()   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 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Igni\Http;
4
5
/**
6
 * Represents expression that is matched against requested uri.
7
 * Route should be immutable object.
8
 *
9
 * @package Igni\Http
10
 */
11
interface Route
12
{
13
    /**
14
     * Return instance with specific attributes
15
     * @param array $attributes
16
     * @return Route
17
     */
18
    public function withAttributes(array $attributes): Route;
19
20
    /**
21
     * Returns route's attributes extracted from requested uri
22
     * @return array
23
     */
24
    public function getAttributes(): array;
25
26
    /**
27
     * Returns instance with specific controller
28
     * @param $controller callable or Controller instance
29
     * @return Route
30
     */
31
    public function withController($controller): Route;
32
33
    /**
34
     * Should return callable that accepts psr-request and return psr-response instances or Controller instance.
35
     * @see Controller
36
     * @return callable
37
     */
38
    public function getController();
39
40
    /**
41
     * Returns expression that is later matched against requested uri.
42
     * @return string
43
     */
44
    public function getPath(): string;
45
46
    /**
47
     * Returns route that can be matched against specified methods.
48
     * @param array $methods
49
     * @return Route
50
     */
51
    public function withMethods(array $methods): Route;
52
53
    /**
54
     * Returns requested methods that are accepted by the route.
55
     * @return array
56
     */
57
    public function getMethods(): array;
58
}
59