CompositionDefinition   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 54
rs 10
c 0
b 0
f 0

4 Methods

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