Completed
Branch feature/split-orm (fa2f8e)
by Anton
03:35
created

IndexDefinition   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getIndex() 0 4 1
A getOptions() 0 4 1
A __toString() 0 7 1
1
<?php
2
/**
3
 * components
4
 *
5
 * @author    Wolfy-J
6
 */
7
namespace Spiral\ODM\Schemas;
8
9
/**
10
 * Index definition options.
11
 */
12
final class IndexDefinition
13
{
14
    /**
15
     * @var array
16
     */
17
    private $index;
18
19
    /**
20
     * @var array
21
     */
22
    private $options;
23
24
    /**
25
     * @param array $index
26
     * @param array $options
27
     */
28
    public function __construct(array $index, array $options = [])
29
    {
30
        $this->index = $index;
31
        $this->options = $options;
32
    }
33
34
    /**
35
     * @return array
36
     */
37
    public function getIndex(): array
38
    {
39
        return $this->index;
40
    }
41
42
    /**
43
     * @return array
44
     */
45
    public function getOptions(): array
46
    {
47
        return $this->options;
48
    }
49
50
    /**
51
     * So we can compare indexes.
52
     *
53
     * @return string
54
     */
55
    public function __toString()
56
    {
57
        return json_encode([
58
            $this->index,
59
            $this->options
60
        ]);
61
    }
62
}