-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoute.php
30 lines (27 loc) · 1.03 KB
/
Route.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace ICanBoogie\Binding\Routing\Attribute;
use Attribute;
use ICanBoogie\HTTP\RequestMethod;
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
class Route
{
/**
* @param string $pattern
* The pattern of the route.
* It is alright to have an _empty_ pattern as long as a {@see Route} is defined on the controller class
* to define the base pattern.
* @param string|null $action
* Identifier of a qualified action; for example, 'articles:show'.
* If it is not defined, the action might be resolved from the controller and the method.
* @param RequestMethod|RequestMethod[] $methods
* Request method(s) accepted by the route.
* @param string|null $id
*/
public function __construct(
public readonly string $pattern,
public readonly ?string $action = null,
public readonly RequestMethod|array $methods = RequestMethod::METHOD_ANY,
public readonly ?string $id = null,
) {
}
}