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

IndexDefinition::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
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;
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
}