Passed
Push — master ( c93c78...d9ab06 )
by Anton
04:33 queued 02:57
created

Embeddable::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 2
nc 2
nop 1
1
<?php
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license   MIT
6
 * @author    Anton Titov (Wolfy-J)
7
 */
8
declare(strict_types=1);
9
10
namespace Cycle\Annotated\Annotation;
11
12
use Doctrine\Common\Annotations\Annotation\Attribute;
13
use Doctrine\Common\Annotations\Annotation\Attributes;
14
use Doctrine\Common\Annotations\Annotation\Target;
15
16
/**
17
 * @Annotation
18
 * @Target("CLASS")
19
 * @Attributes({
20
 *      @Attribute("role", type="string"),
21
 *      @Attribute("mapper", type="string"),
22
 *      @Attribute("columnPrefix", type="string"),
23
 *      @Attribute("columns", type="array<Cycle\Annotated\Annotation\Column>"),
24
 * })
25
 */
26
final class Embeddable
27
{
28
    /** @var string */
29
    private $role;
30
31
    /** @var string */
32
    private $mapper;
33
34
    /** @var string */
35
    private $columnPrefix = '';
36
37
    /** @var array<Column> */
38
    private $columns = [];
39
40
    /**
41
     * @param array $values
42
     */
43
    public function __construct(array $values)
44
    {
45
        foreach ($values as $key => $value) {
46
            $this->$key = $value;
47
        }
48
    }
49
50
    /**
51
     * @return string|null
52
     */
53
    public function getRole(): ?string
54
    {
55
        return $this->role;
56
    }
57
58
    /**
59
     * @return string|null
60
     */
61
    public function getMapper(): ?string
62
    {
63
        return $this->mapper;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getColumnPrefix(): string
70
    {
71
        return $this->columnPrefix;
72
    }
73
74
    /**
75
     * @return Column[]
76
     */
77
    public function getColumns(): array
78
    {
79
        return $this->columns;
80
    }
81
}