Property   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 33
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttributes() 0 12 3
A getType() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Igni\Storage\Mapping\Annotation;
4
5
use Doctrine\Common\Annotations\Annotation;
6
use function get_object_vars;
7
use function method_exists;
8
use function ucfirst;
9
10
/**
11
 * @Annotation
12
 */
13
class Property extends Annotation
14
{
15
    /**
16
     * @var string
17
     */
18
    public $name;
19
20
    /**
21
     * @var string
22
     */
23
    public $type = 'text';
24
25
    public $class;
26
27
    public $readonly = false;
28
29 22
    public function getType(): string
30
    {
31 22
        return $this->type;
32
    }
33
34 23
    public function getAttributes(): array
35
    {
36 23
        $attributes = get_object_vars($this);
37 23
        foreach ($attributes as $name => $value) {
38 23
            $method = 'get' . ucfirst($name);
39 23
            if (method_exists($this, $method)) {
40 23
                $attributes[$name] = $this->$method();
41
            }
42
        }
43
        //unset($attributes['type'], $attributes['value'], $attributes['name']);
44
45 23
        return $attributes;
46
    }
47
}
48