1 | <?php |
||
5 | final class Route implements RouteInterface |
||
6 | { |
||
7 | /** |
||
8 | * @var array |
||
9 | */ |
||
10 | private static $availableMethods = [ |
||
11 | 'GET', |
||
12 | 'POST', |
||
13 | 'PUT', |
||
14 | 'PATCH', |
||
15 | 'DELETE', |
||
16 | 'HEAD', |
||
17 | 'OPTION', |
||
18 | ]; |
||
19 | |||
20 | /** |
||
21 | * @var string[] |
||
22 | */ |
||
23 | private $methods; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $pattern; |
||
29 | |||
30 | /** |
||
31 | * @var mixed |
||
32 | */ |
||
33 | private $handler; |
||
34 | |||
35 | /** |
||
36 | * @param string|string[] $method The HTTP method, or an array of, to match |
||
37 | * @param string $pattern The URI pattern |
||
38 | * @param mixed $handler The handler |
||
39 | */ |
||
40 | 39 | public function __construct($method, $pattern, $handler) |
|
51 | |||
52 | /** |
||
53 | * @param string $method The HTTP method type |
||
54 | * @param string $arguments The arguments to allow __construct to be called |
||
55 | * |
||
56 | * @throws \InvalidArgumentException |
||
57 | * |
||
58 | * @return Route |
||
59 | */ |
||
60 | 23 | public static function __callStatic($method, $arguments) |
|
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | 36 | public function getMethods() |
|
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | 33 | public function getPattern() |
|
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | 27 | public function getHandler() |
|
98 | } |
||
99 |
Late static binding only has effect in subclasses. A
final
class cannot be extended anymore so late static binding cannot occurr. Consider replacingstatic::
withself::
.To learn more about late static binding, please refer to the PHP core documentation.