Completed
Pull Request — master (#411)
by
unknown
02:03
created

TokenQuery::whereUserId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the 2amigos/yii2-usuario project.
5
 *
6
 * (c) 2amigOS! <http://2amigos.us/>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace Da\User\Query;
13
14
use Da\User\Model\Token;
15
use yii\db\ActiveQuery;
16
17
class TokenQuery extends ActiveQuery
18
{
19
    /**
20
     * @param $userId
21
     *
22
     * @return $this
23
     */
24 2
    public function whereUserId($userId)
25
    {
26 2
        return $this->andWhere(['user_id' => $userId]);
27
    }
28
29
    /**
30
     * @param $code
31
     *
32
     * @return $this
33
     */
34 2
    public function whereCode($code)
35
    {
36 2
        return $this->andWhere(['code' => $code]);
37
    }
38
39
    /**
40
     * @return $this
41
     */
42
    public function whereIsRecoveryType()
43
    {
44
        return $this->andWhere(['type' => Token::TYPE_RECOVERY]);
45
    }
46
47
    /**
48
     * @return $this
49
     */
50 1
    public function whereIsConfirmationType()
51
    {
52 1
        return $this->andWhere(['type' => Token::TYPE_CONFIRMATION]);
53
    }
54
55
    /**
56
     * @param array $types
57
     *
58
     * @return $this
59
     */
60 1
    public function whereIsTypes(array $types)
61
    {
62 1
        return $this->andWhere(['in', 'type', $types]);
63
    }
64
}
65