Completed
Push — master ( 087102...36165a )
by vistart
10:17
created

BaseUserQuery   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 35
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A active() 0 8 2
A source() 0 12 3
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
/**
16
 * Description of BaseUserQuery
17
 *
18
 * @version 1.0
19
 * @author vistart <[email protected]>
20
 */
21
class BaseUserQuery extends BaseEntityQuery
22
{
23
24
    /**
25
     * Specify active status.
26
     * @param integer $active
27
     * @return static
28
     */
29 2
    public function active($active)
30
    {
31 2
        $model = $this->noInitModel;
32 2
        if (!is_string($model->statusAttribute)) {
33
            return $this;
34
        }
35 2
        return $this->andWhere([$model->statusAttribute => $active]);
36
    }
37
38
    /**
39
     * Specify source.
40
     * @param null|string|array $source
41
     * @return static
42
     */
43 1
    public function source($source = null)
44
    {
45 1
        $model = $this->noInitModel;
46 1
        if (!is_string($model->sourceAttribute)) {
47
            return $this;
48
        }
49 1
        if (!is_string($source)) {
50
            $modelClass = $this->modelClass;
51
            $source = $modelClass::$sourceSelf;
52
        }
53 1
        return $this->andWhere([$model->sourceAttribute => $source]);
54
    }
55
}
56