Completed
Push — master ( 085f18...5909bf )
by Andrii
19:10
created

Identity   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 28
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 11 1
A isActive() 0 4 1
1
<?php
2
3
/*
4
 * HIAM module for MRDP database compatibility
5
 *
6
 * @link      https://github.com/hiqdev/hiam-mrdp
7
 * @package   hiam-mrdp
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hiam\mrdp\models;
13
14
/**
15
 * Identity model for MRDP database.
16
 *
17
 * @property string $roles
18
 * @property string $seller
19
 * @property integer $seller_id
20
 */
21
class Identity extends \hiam\models\Identity
22
{
23
    public $roles;
24
    public $seller;
25
    public $seller_id;
26
27
    protected $activeStates = ['ok', 'active'];
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function rules()
33
    {
34
        return array_merge(parent::rules(), [
35
            ['seller_id',       'integer'],
36
37
            ['seller',          'trim'],
38
            ['seller',          'string', 'min' => 2, 'max' => 64],
39
40
            ['roles',           'trim'],
41
        ]);
42
    }
43
44
    public function isActive()
45
    {
46
        return in_array($this->state, $this->activeStates, true);
47
    }
48
}
49