Completed
Pull Request — master (#212)
by Alexandru
43:58 queued 01:14
created

Index::columns()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 13
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 0
crap 3
1
<?php
2
3
namespace Rennokki\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 1
    public function __construct($name, $hash, $range)
23
    {
24 1
        $this->name = $name;
25 1
        $this->hash = $hash;
26 1
        $this->range = $range;
27 1
    }
28
29
    public function isComposite()
30
    {
31
        return isset($this->hash) && isset($this->range);
32
    }
33
34 1
    public function columns()
35
    {
36 1
        $columns = [];
37
38 1
        if ($this->hash) {
39 1
            $columns[] = $this->hash;
40
        }
41
42 1
        if ($this->range) {
43 1
            $columns[] = $this->range;
44
        }
45
46 1
        return $columns;
47
    }
48
}
49