Completed
Push — master ( ff3d5b...77ffdb )
by hook
06:35
created

DynamoDBGrammar   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 0 2 1
A parseProjectionExpression() 0 6 2
A parseLimit() 0 2 1
A getOperators() 0 3 1
A parseKeyConditionExpression() 0 7 2
1
<?php
2
namespace Hoooklife\DynamodbPodm\Grammars;
3
class DynamoDBGrammar{
4
    protected $operators = [];
5
6
    protected $params = [];
7
8
    // 表达式解析 where
9
    public function parseKeyConditionExpression(){
10
        $expression = [];
11
        foreach ($this->wheres as $where) {
0 ignored issues
show
Bug Best Practice introduced by
The property wheres does not exist on Hoooklife\DynamodbPodm\Grammars\DynamoDBGrammar. Did you maybe forget to declare it?
Loading history...
12
            $expression[] = "{$where['column']} {$where['operator']} {$where['value']}";
13
        }
14
15
        return implode("and", $expression);
16
17
    }
18
19
    // select
20
    public function parseProjectionExpression()
21
    {
22
        if( reset($this->columns) != '*'  ){
0 ignored issues
show
Bug Best Practice introduced by
The property columns does not exist on Hoooklife\DynamodbPodm\Grammars\DynamoDBGrammar. Did you maybe forget to declare it?
Loading history...
23
            return implode(",", $this->columns);
24
        }
25
        return null;
26
    }
27
28
    // limit
29
    public function parseLimit(){
30
        return $this->limit;
0 ignored issues
show
Bug Best Practice introduced by
The property limit does not exist on Hoooklife\DynamodbPodm\Grammars\DynamoDBGrammar. Did you maybe forget to declare it?
Loading history...
31
    }
32
    
33
     /**
34
     * Get the grammar specific operators.
35
     *
36
     * @return array
37
     */
38
    public function getOperators()
39
    {
40
        return $this->operators;
41
    }
42
43
    public function all()
44
    {
45
        
46
    }
47
}