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

Table::__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 Cycle\Annotated\Annotation\Table\Index;
13
use Doctrine\Common\Annotations\Annotation\Attribute;
14
use Doctrine\Common\Annotations\Annotation\Attributes;
15
use Doctrine\Common\Annotations\Annotation\Target;
16
17
/**
18
 * @Annotation
19
 * @Target({"CLASS", "ANNOTATION"})
20
 * @Attributes({
21
 *      @Attribute("columns", type="array<Cycle\Annotated\Annotation\Column>"),
22
 *      @Attribute("indexes", type="array<Cycle\Annotated\Annotation\Table\Index>"),
23
 * })
24
 */
25
final class Table
26
{
27
    /** @var array<Column> */
28
    private $columns = [];
29
30
    /** @var array<Index> */
31
    private $indexes = [];
32
33
    /**
34
     * @param array $values
35
     */
36
    public function __construct(array $values)
37
    {
38
        foreach ($values as $key => $value) {
39
            $this->$key = $value;
40
        }
41
    }
42
43
    /**
44
     * @return Column[]
45
     */
46
    public function getColumns(): array
47
    {
48
        return $this->columns;
49
    }
50
51
    /**
52
     * @return Index[]
53
     */
54
    public function getIndexes(): array
55
    {
56
        return $this->indexes;
57
    }
58
}