Tag::getPriority()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace TheCodingMachine\Funky\Annotations;
5
6
/**
7
 * @Annotation
8
 * @Target({"ANNOTATION"})
9
 * @Attributes({
10
 *   @Attribute("name", type = "string", required=true),
11
 *   @Attribute("priority", type = "float"),
12
 * })
13
 */
14
class Tag
15
{
16
    /**
17
     * @var string
18
     */
19
    private $name;
20
    /**
21
     * @var float
22
     */
23
    private $priority;
24
25
    /**
26
     * @param mixed[] $attributes
27
     */
28
    public function __construct(array $attributes = [])
29
    {
30
        $this->name = $attributes['name'];
31
        $this->priority = $attributes['priority'] ?? 0.0;
32
    }
33
34
    public function getName(): string
35
    {
36
        return $this->name;
37
    }
38
    public function getPriority(): float
39
    {
40
        return $this->priority;
41
    }
42
}
43