Index   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 14
c 1
b 0
f 0
dl 0
loc 42
ccs 12
cts 14
cp 0.8571
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isComposite() 0 3 2
A __construct() 0 5 1
A columns() 0 13 3
1
<?php
2
3
namespace BaoPham\DynamoDb\ConditionAnalyzer;
4
5
class Index
6
{
7
    /**
8
     * @var string
9
     */
10
    public $name;
11
12
    /**
13
     * @var string
14
     */
15
    public $hash;
16
17
    /**
18
     * @var string
19
     */
20
    public $range;
21
22 27
    public function __construct($name, $hash, $range)
23
    {
24 27
        $this->name = $name;
25 27
        $this->hash = $hash;
26 27
        $this->range = $range;
27 27
    }
28
29
    public function isComposite()
30
    {
31
        return isset($this->hash) && isset($this->range);
32
    }
33
34 8
    public function columns()
35
    {
36 8
        $columns = [];
37
38 8
        if ($this->hash) {
39 8
            $columns[] = $this->hash;
40
        }
41
42 8
        if ($this->range) {
43 4
            $columns[] = $this->range;
44
        }
45
46 8
        return $columns;
47
    }
48
}
49