Controller   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 70%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 32
ccs 7
cts 10
cp 0.7
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMiddlewares() 0 3 1
A getRoute() 0 3 1
A __construct() 0 7 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiistack\Routing\Annotation;
6
7
use Doctrine\Common\Annotations\Annotation\Target;
8
9
/**
10
 * @Annotation
11
 * @Target("CLASS")
12
 */
13
final class Controller
14
{
15
    /**
16
     * @var mixed|string
17
     * @psalm-suppress PropertyNotSetInConstructor
18
     */
19
    private string $route;
20
21
    /**
22
     * @var array
23
     * @psalm-suppress PropertyNotSetInConstructor
24
     */
25
    private array $middlewares;
26
27 1
    public function __construct(array $values)
28
    {
29 1
        if (isset($values['value'])) {
30 1
            $this->route = $values['value'];
31
        }
32 1
        if (isset($values['middlewares'])) {
33
            $this->middlewares = $values['middlewares'];
34
        }
35 1
    }
36
37 1
    public function getRoute(): string
38
    {
39 1
        return $this->route;
40
    }
41
42
    public function getMiddlewares(): array
43
    {
44
        return $this->middlewares;
45
    }
46
}
47