1 | <?php |
||
32 | final class Route |
||
33 | { |
||
34 | private const AVAILABLE_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']; |
||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $pattern; |
||
39 | |||
40 | /** |
||
41 | * @var array|null |
||
42 | */ |
||
43 | private $methods; |
||
44 | |||
45 | /** |
||
46 | * @var string|null |
||
47 | */ |
||
48 | private $name; |
||
49 | |||
50 | /** |
||
51 | * Route constructor. |
||
52 | * |
||
53 | * @param array $values |
||
54 | * |
||
55 | * @throws InvalidArgumentException |
||
56 | */ |
||
57 | 5 | public function __construct(array $values) |
|
79 | |||
80 | /** |
||
81 | * Get pattern |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | 5 | public function getPattern(): string |
|
89 | |||
90 | /** |
||
91 | * Get methods |
||
92 | * |
||
93 | * @return array|null |
||
94 | */ |
||
95 | 5 | public function getMethods(): ?array |
|
99 | |||
100 | /** |
||
101 | * Get name |
||
102 | * |
||
103 | * @return null|string |
||
104 | */ |
||
105 | 5 | public function getName(): ?string |
|
109 | } |
||
110 |