Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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 | } |
||
44 |