Passed
Push — master ( e288dc...71d24f )
by Richard
01:40
created

Between::getSql()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 3
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
namespace Maphper\Lib\Sql;
3
4
class Between implements WhereConditional {
5
    public function matches($key, $value, $mode) {
6
        return is_array($value) && \Maphper\Maphper::FIND_BETWEEN & $mode;
7
    }
8
9
    public function getSql($key, $value, $mode) {
10
        return [
11
            'sql' => [
12
                $key . '>= :' . $key . 'from',
13
                $key . ' <= :' . $key . 'to'
14
            ],
15
            'args' => [
16
                $key . 'from' => $value[0],
17
                $key . 'to' => $value[1]
18
            ]
19
        ];
20
    }
21
}
22