1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* It's free open-source software released under the MIT License. |
5
|
|
|
* |
6
|
|
|
* @author Anatoly Nekhay <[email protected]> |
7
|
|
|
* @copyright Copyright (c) 2018, Anatoly Nekhay |
8
|
|
|
* @license https://github.com/sunrise-php/http-router/blob/master/LICENSE |
9
|
|
|
* @link https://github.com/sunrise-php/http-router |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Sunrise\Http\Router\Annotation; |
15
|
|
|
|
16
|
|
|
use Attribute; |
17
|
|
|
use Fig\Http\Message\RequestMethodInterface; |
18
|
|
|
use Sunrise\Coder\MediaTypeInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @link https://dev.sunrise-studio.io/docs/reference/routing-annotations?id=route |
22
|
|
|
* @since 2.0.0 |
23
|
|
|
*/ |
24
|
|
|
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] |
25
|
|
|
class Route implements RequestMethodInterface |
26
|
|
|
{ |
27
|
|
|
public mixed $holder = null; |
28
|
|
|
|
29
|
|
|
/** @var array<array-key, string> */ |
|
|
|
|
30
|
|
|
public array $namePrefixes = []; |
31
|
|
|
|
32
|
|
|
/** @var array<array-key, string> */ |
|
|
|
|
33
|
|
|
public array $pathPrefixes = []; |
34
|
|
|
|
35
|
|
|
/** @var non-empty-string|null */ |
|
|
|
|
36
|
|
|
public ?string $pattern = null; |
37
|
|
|
|
38
|
50 |
|
public function __construct( |
39
|
|
|
public string $name, |
40
|
|
|
public string $path = '', |
41
|
|
|
/** @var array<string, string> */ |
42
|
|
|
public array $patterns = [], |
43
|
|
|
/** @var array<array-key, string> */ |
44
|
|
|
public array $methods = [], |
45
|
|
|
/** @var array<string, mixed> */ |
46
|
|
|
public array $attributes = [], |
47
|
|
|
/** @var array<array-key, mixed> */ |
48
|
|
|
public array $middlewares = [], |
49
|
|
|
/** @var array<array-key, MediaTypeInterface> */ |
50
|
|
|
public array $consumes = [], |
51
|
|
|
/** @var array<array-key, MediaTypeInterface> */ |
52
|
|
|
public array $produces = [], |
53
|
|
|
/** @var array<array-key, string> */ |
54
|
|
|
public array $tags = [], |
55
|
|
|
public string $summary = '', |
56
|
|
|
public string $description = '', |
57
|
|
|
public bool $isDeprecated = false, |
58
|
|
|
public bool $isApiRoute = false, |
59
|
|
|
public int $priority = 0, |
60
|
|
|
) { |
61
|
50 |
|
} |
62
|
|
|
} |
63
|
|
|
|