BaseRedisBlameableModel::findByIdentity()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 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\queries\BaseRedisBlameableQuery;
16
use vistart\Models\traits\BlameableTrait;
17
18
/**
19
 * Description of BaseRedisBlameableModel
20
 *
21
 * @author vistart <[email protected]>
22
 */
23
abstract class BaseRedisBlameableModel extends BaseRedisEntityModel
24
{
25
    use BlameableTrait;
26
27
    /**
28
     * Initialize the blameable model.
29
     * If query class is not specified, [[BaseBlameableQuery]] will be taken.
30
     */
31 6
    public function init()
32
    {
33 6
        if (!is_string($this->queryClass)) {
34 2
            $this->queryClass = BaseRedisBlameableQuery::className();
35 2
        }
36 6
        if ($this->skipInit) {
37 2
            return;
38
        }
39 6
        $this->initBlameableEvents();
40 6
        parent::init();
41 6
    }
42
43
    /**
44
     * Get the query class with specified identity.
45
     * @param BaseUserModel $identity
46
     * @return BaseRedisBlameableQuery
47
     */
48 1
    public static function findByIdentity($identity = null)
49
    {
50 1
        return static::find()->byIdentity($identity);
51
    }
52
}
53