Profile   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 45.45%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 40
c 0
b 0
f 0
rs 10
ccs 5
cts 11
cp 0.4545

4 Methods

Rating   Name   Duplication   Size   Complexity  
A tableName() 0 4 1
A rules() 0 7 1
A attributeLabels() 0 8 1
A getUser() 0 4 1
1
<?php
2
3
namespace inblank\activeuser\models;
4
5
use inblank\activeuser\traits\CommonTrait;
6
use yii;
7
use yii\db\ActiveRecord;
8
9
/**
10
 * This is the model class for table "{{%activeuser_profiles}}".
11
 * @property integer $user_id user identifier
12
 * @property string $site user web site
13
 * @property string $location user location
14
 */
15
class Profile extends ActiveRecord
16
{
17
    use CommonTrait;
18
19
    /**
20
     * @inheritdoc
21
     */
22 16
    public static function tableName()
23
    {
24 16
        return '{{%activeuser_profiles}}';
25
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30 9
    public function rules()
31
    {
32
        return [
33 9
            ['user_id', 'required'],
34 9
            ['user_id', 'exist', 'targetClass' => self::di('User'), 'targetAttribute' => 'id'],
35
        ];
36
    }
37
38
    /**
39
     * @inheritdoc
40
     */
41
    public function attributeLabels()
42
    {
43
        return [
44
            'user_id' => 'ID',
45
            'site' => Yii::t('activeuser_general', 'Web site'),
46
            'location' => Yii::t('activeuser_general', 'Location'),
47
        ];
48
    }
49
50
    public function getUser()
51
    {
52
        return $this->hasOne(self::di('User'), ['id' => 'user_id']);
53
    }
54
}
55