Route::getHandler()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace MatthiasMullie\Api\Routes;
4
5
/**
6
 * @author Matthias Mullie <[email protected]>
7
 * @copyright Copyright (c) 2016, Matthias Mullie. All rights reserved
8
 * @license LICENSE MIT
9
 */
10
class Route implements RouteInterface
11
{
12
    /**
13
     * @var string[]
14
     */
15
    protected $methods;
16
17
    /**
18
     * @var string
19
     */
20
    protected $path;
21
22
    /**
23
     * @var callable
24
     */
25
    protected $handler;
26
27
    /**
28
     * @param string[] $methods
29
     * @param string   $path
30
     * @param callable $handler
31
     */
32
    public function __construct(array $methods, string $path, callable $handler)
33
    {
34
        $this->methods = $methods;
35
        $this->path = $path;
36
        $this->handler = $handler;
37
    }
38
39
    /**
40
     * @return string[]
41
     */
42
    public function getMethods(): array
43
    {
44
        return $this->methods;
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getPath(): string
51
    {
52
        return $this->path;
53
    }
54
55
    /**
56
     * @return callable
57
     */
58
    public function getHandler(): callable
59
    {
60
        return $this->handler;
61
    }
62
}
63