Total Complexity | 5 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 76.92% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | trait Oauth2ActiveRecordTrait |
||
12 | { |
||
13 | /** |
||
14 | * @inheritDoc |
||
15 | */ |
||
16 | 1 | public static function findOrCreate($condition) |
|
17 | { |
||
18 | 1 | $activeRecord = static::findOne($condition); |
|
19 | |||
20 | 1 | if (empty($activeRecord)) { |
|
21 | 1 | $activeRecord = Yii::createObject(ArrayHelper::merge($condition, [ |
|
22 | 1 | 'class' => static::class, |
|
23 | 1 | ])); |
|
24 | } |
||
25 | |||
26 | 1 | return $activeRecord; |
|
27 | } |
||
28 | |||
29 | /** |
||
30 | * @inheritDoc |
||
31 | */ |
||
32 | 1 | public function persist($runValidation = true, $attributeNames = null) |
|
42 | } |
||
43 | } |
||
44 |