Completed
Push — master ( 14d652...6f6b3d )
by vistart
05:22
created

BaseRedisEntityQuery::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 0
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 *  _   __ __ _____ _____ ___  ____  _____
5
 * | | / // // ___//_  _//   ||  __||_   _|
6
 * | |/ // /(__  )  / / / /| || |     | |
7
 * |___//_//____/  /_/ /_/ |_||_|     |_|
8
 * @link https://vistart.me/
9
 * @copyright Copyright (c) 2016 - 2017 vistart
10
 * @license https://vistart.me/license/
11
 */
12
13
namespace rhosocial\base\models\queries;
14
15
use rhosocial\base\models\traits\EntityQueryTrait;
16
17
/**
18
 * Description of BaseRedisEntityQuery
19
 *
20
 * @version 1.0
21
 * @author vistart <[email protected]>
22
 */
23
class BaseRedisEntityQuery extends \yii\redis\ActiveQuery
24
{
25
    use EntityQueryTrait;
26
    
27 3
    protected static function range($query, $attribute, $start = null, $end = null)
28
    {
29 3
        if (!isset($attribute, $start, $end)) {
30 3
            throw new \yii\db\Exception("`attribute`, `start` and `end` must be specified.");
31 3
        }
32
        return $query->andWhere(['between', $attribute, $start, $end]);
33
    }
34
35
    public function init()
36
    {
37
        $this->buildNoInitModel();
38
        parent::init();
39
    }
40
}
41