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

Between::matches()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 3
dl 0
loc 2
rs 10
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