IndexDefinition::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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