Completed
Branch feature/split-orm (94afb7)
by Anton
03:11
created

CompositionDefinition::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * components
4
 *
5
 * @author    Wolfy-J
6
 */
7
namespace Spiral\ODM\Schemas\Definitions;
8
9
/**
10
 * Composition definition.
11
 */
12
final class CompositionDefinition
13
{
14
    /**
15
     * Composition type, see DocumentEntity::ONE and DocumentEntity::MANY.
16
     *
17
     * @var int
18
     */
19
    private $type;
20
21
    /**
22
     * Nested class.
23
     *
24
     * @var string
25
     */
26
    private $class;
27
28
    /**
29
     * @param int    $type
30
     * @param string $class
31
     */
32
    public function __construct(int $type, string $class)
33
    {
34
        $this->type = $type;
35
        $this->class = $class;
36
    }
37
38
    /**
39
     * Composition type, see Document::ONE and Document::MANY.
40
     *
41
     * @return int
42
     */
43
    public function getType(): int
44
    {
45
        return $this->type;
46
    }
47
48
    /**
49
     * Nested class.
50
     *
51
     * @return string
52
     */
53
    public function getClass(): string
54
    {
55
        return $this->class;
56
    }
57
58
    /**
59
     * @return array
60
     */
61
    public function packSchema(): array
62
    {
63
        return [$this->type, $this->class];
64
    }
65
}