Route   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 9
Bugs 0 Features 0
Metric Value
eloc 6
c 9
b 0
f 0
dl 0
loc 37
ccs 1
cts 1
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 23 1
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> */
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<array-key, string> at position 2 could not be parsed: Unknown type name 'array-key' at position 2 in array<array-key, string>.
Loading history...
30
    public array $namePrefixes = [];
31
32
    /** @var array<array-key, string> */
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<array-key, string> at position 2 could not be parsed: Unknown type name 'array-key' at position 2 in array<array-key, string>.
Loading history...
33
    public array $pathPrefixes = [];
34
35
    /** @var non-empty-string|null */
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string|null at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string|null.
Loading history...
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