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 | ]; |
||
18 | |||
19 | /** |
||
20 | * @var string[] |
||
21 | */ |
||
22 | private $methods; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $pattern; |
||
28 | |||
29 | /** |
||
30 | * @var mixed |
||
31 | */ |
||
32 | private $handler; |
||
33 | |||
34 | /** |
||
35 | * @param string|string[] $method The HTTP method, or an array of, to match |
||
36 | * @param string $pattern The URI pattern |
||
37 | * @param mixed $handler The handler |
||
38 | */ |
||
39 | 36 | public function __construct($method, $pattern, $handler) |
|
50 | |||
51 | /** |
||
52 | * @param string $method The HTTP method type |
||
53 | * @param string $arguments The arguments to allow __construct to be called |
||
54 | * |
||
55 | * @throws \InvalidArgumentException |
||
56 | * |
||
57 | * @return Route |
||
58 | */ |
||
59 | 21 | public static function __callStatic($method, $arguments) |
|
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | 33 | public function getMethods() |
|
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | 30 | public function getPattern() |
|
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | */ |
||
93 | 24 | public function getHandler() |
|
97 | } |
||
98 |
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.