IndexDefinition   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 51
rs 10
c 0
b 0
f 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
 * 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
}