ResourceParam   A
last analyzed

Complexity

Total Complexity 1

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 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Resource\Annotation;
6
7
// phpcs:disable SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse
8
use Attribute;
9
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
10
use Ray\Di\Di\Qualifier;
11
12
// phpcs:enable
13
14
/**
15
 * @Annotation
16
 * @Target("METHOD")
17
 * @NamedArgumentConstructor
18
 */
19
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_PARAMETER)]
20
#[Qualifier]
21
final class ResourceParam implements RequestParamInterface
22
{
23
    /** @var string */
24
    public $param;
25
26
    /** @var string */
27
    public $uri;
28
29
    /** @var bool */
30
    public $templated;
31
32
    /**
33
     * @param array{uri?: string, param?: string, templated?: bool} $values
34
     *
35
     * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
36
     */
37
    public function __construct(array $values = [], string $uri = '', string $param = '', bool $templated = false)
38
    {
39
        $this->uri = $values['uri'] ?? $uri;
40
        $this->param = $values['param'] ?? $param;
41
        $this->templated = $values['templated'] ?? $templated;
42
    }
43
}
44