Completed
Push — master ( a42add...affc33 )
by vistart
05:14
created

BaseRedisBlameableModel   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 1
cbo 2
dl 0
loc 30
ccs 0
cts 11
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 11 3
A findByIdentity() 0 4 1
1
<?php
2
3
/**
4
 *  _   __ __ _____ _____ ___  ____  _____
5
 * | | / // // ___//_  _//   ||  __||_   _|
6
 * | |/ // /(__  )  / / / /| || |     | |
7
 * |___//_//____/  /_/ /_/ |_||_|     |_|
8
 * @link https://vistart.name/
9
 * @copyright Copyright (c) 2016 vistart
10
 * @license https://vistart.name/license/
11
 */
12
13
namespace vistart\Models\models;
14
15
use vistart\Models\traits\BlameableTrait;
16
17
/**
18
 * Description of BaseRedisBlameableModel
19
 *
20
 * @author vistart <[email protected]>
21
 */
22
class BaseRedisBlameableModel extends BaseRedisEntityModel
23
{
24
    use BlameableTrait;
25
26
    /**
27
     * Initialize the blameable model.
28
     * If query class is not specified, [[BaseBlameableQuery]] will be taken.
29
     */
30
    public function init()
31
    {
32
        if (!is_string($this->queryClass)) {
33
            $this->queryClass = \vistart\Models\queries\BaseRedisBlameableQuery::className();
34
        }
35
        if ($this->skipInit) {
36
            return;
37
        }
38
        $this->initBlameableEvents();
39
        parent::init();
40
    }
41
42
    /**
43
     * Get the query class with specified identity.
44
     * @param \vistart\Models\models\BaseUserModel $identity
45
     * @return \vistart\Models\queries\BaseBlameableQuery
46
     */
47
    public static function findByIdentity($identity = null)
48
    {
49
        return static::find()->byIdentity($identity);
50
    }
51
}
52