Route   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 78.56%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 46
ccs 11
cts 14
cp 0.7856
rs 10
wmc 7

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getRoute() 0 3 1
A getMethods() 0 3 1
A getMiddlewares() 0 3 1
A __construct() 0 10 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiistack\Routing\Annotation;
6
7
/**
8
 * Class Route
9
 * @package Yiistack\Routing\Annotation
10
 */
11
abstract class Route implements RouteAnnotationInterface
12
{
13
    /**
14
     * @var mixed|string
15
     * @psalm-suppress PropertyNotSetInConstructor
16
     */
17
    protected string $route;
18
19
    /**
20
     * @var array
21
     * @psalm-suppress PropertyNotSetInConstructor
22
     */
23
    protected array $methods;
24
25
    /**
26
     * @var array
27
     * @psalm-suppress PropertyNotSetInConstructor
28
     */
29
    protected array $middlewares;
30
31 1
    public function __construct(array $values)
32
    {
33 1
        if (isset($values['value'])) {
34 1
            $this->route = $values['value'];
35
        }
36 1
        if (isset($values['middlewares'])) {
37
            $this->middlewares = $values['middlewares'];
38
        }
39 1
        if (isset($values['methods'])) {
40 1
            $this->methods = $values['methods'];
41
        }
42 1
    }
43
44 1
    public function getRoute(): string
45
    {
46 1
        return $this->route;
47
    }
48
49 1
    public function getMethods(): array
50
    {
51 1
        return $this->methods;
52
    }
53
54
    public function getMiddlewares(): array
55
    {
56
        return $this->middlewares;
57
    }
58
}
59