BaseAnnotation   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 15 3
1
<?php
2
3
/**
4
 * This file is part of Blitz PHP framework.
5
 *
6
 * (c) 2022 Dimitri Sitchet Tomkeu <[email protected]>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace BlitzPHP\Annotations;
13
14
use mindplay\annotations\Annotation;
15
use ReflectionClass;
16
17
/**
18
 * Classe abstraite servant de base pour les annotations
19
 */
20
abstract class BaseAnnotation extends Annotation
21
{
22
    /**
23
     * @var mixed
24
     *
25
     * La valeur de cette annotation
26
     */
27
    public $value;
28
29
    /**
30
     * Recupère la valeur de cette annotation
31
     *
32
     * @return mixed
33
     */
34
    public function getValue()
35
    {
36
        if (! empty($this->value)) {
37
            return $this->value;
38
        }
39
40
        $value = [];
41
42
        $reflection = new ReflectionClass($this);
43
44
        foreach ($reflection->getProperties() as $property) {
45
            $value[$property->getName()] = $property->getValue();
46
        }
47
48
        return $value;
49
    }
50
}
51