SocialNetworkAccountQuery   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 22
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A whereId() 0 4 1
A whereClient() 0 9 1
A whereCode() 0 4 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\Contracts\AuthClientInterface;
15
use yii\db\ActiveQuery;
16
17
class SocialNetworkAccountQuery extends ActiveQuery
18
{
19
    public function whereId($id)
20
    {
21
        return $this->andWhere(['id' => $id]);
22
    }
23
24
    public function whereClient(AuthClientInterface $client)
25
    {
26
        return $this->andWhere(
27
            [
28
                'provider' => $client->getId(),
29
                'client_id' => (string)$client->getUserAttributes()['id'],
30
            ]
31
        );
32
    }
33
34
    public function whereCode($code)
35
    {
36
        return $this->andWhere(['code' => md5($code)]);
37
    }
38
}
39