Controller::getRoute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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