UserQuery::one()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace inblank\activeuser\models;
4
5
use yii\db\ActiveQuery;
6
7
/**
8
 * This is the ActiveQuery class for [[User]].
9
 *
10
 * @see User
11
 */
12
class UserQuery extends ActiveQuery
13
{
14
    /**
15
     * Filter only active user
16
     * @return $this
17
     */
18 1
    public function active()
19
    {
20 1
        $this->andWhere('[[status]]=' . User::STATUS_ACTIVE);
21 1
        return $this;
22
    }
23
24
    /**
25
     * Filter only blocked user
26
     * @return $this
27
     */
28 1
    public function blocked()
29
    {
30 1
        $this->andWhere('[[status]]=' . User::STATUS_BLOCKED);
31 1
        return $this;
32
    }
33
34
    /**
35
     * Filter only user waiting confirmation
36
     * @return $this
37
     */
38 1
    public function notConfirmed()
39
    {
40 1
        $this->andWhere('[[status]]=' . User::STATUS_CONFIRM);
41 1
        return $this;
42
    }
43
44
    /**
45
     * Filter user that requested access restore
46
     * @return $this
47
     */
48 1
    public function restoring()
49
    {
50 1
        $this->andWhere('[[status]]=' . User::STATUS_RESTORE);
51 1
        return $this;
52
    }
53
54
    /**
55
     * @inheritdoc
56
     * @return User[]|array
57
     */
58 2
    public function all($db = null)
59
    {
60 2
        return parent::all($db);
61
    }
62
63
    /**
64
     * @inheritdoc
65
     * @return User|array|null
66
     */
67 13
    public function one($db = null)
68
    {
69 13
        return parent::one($db);
0 ignored issues
show
Bug Compatibility introduced by
The expression parent::one($db); of type yii\db\ActiveRecord|array|null adds the type yii\db\ActiveRecord to the return on line 69 which is incompatible with the return type declared by the interface yii\db\QueryInterface::one of type array|boolean.
Loading history...
70
    }
71
}
72