Passed
Push — master ( 4c80ea...de511c )
by Rustam
01:28
created

Controller   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 23
rs 10
c 2
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRoute() 0 3 1
A __construct() 0 7 3
A getMiddlewares() 0 3 1
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
    private string $route;
16
    private array $middlewares;
17
18
    public function __construct(array $values)
19
    {
20
        if (isset($values['value'])) {
21
            $this->route = $values['value'];
22
        }
23
        if (isset($values['middlewares'])) {
24
            $this->middlewares = $values['middlewares'];
25
        }
26
    }
27
28
    public function getRoute(): string
29
    {
30
        return $this->route;
31
    }
32
33
    public function getMiddlewares(): array
34
    {
35
        return $this->middlewares;
36
    }
37
}
38