EventTrait::getFormEvent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace yii2mod\user\traits;
4
5
use Yii;
6
use yii\base\Model;
7
use yii2mod\user\events\CreateUserEvent;
8
use yii2mod\user\events\FormEvent;
9
use yii2mod\user\models\UserModel;
10
11
/**
12
 * Class EventTrait
13
 *
14
 * @package yii2mod\user\traits
15
 */
16
trait EventTrait
17
{
18
    /**
19
     * @param Model $form
20
     *
21
     * @return object
22
     */
23
    protected function getFormEvent(Model $form)
24
    {
25
        return Yii::createObject(['class' => FormEvent::class, 'form' => $form]);
26
    }
27
28
    /**
29
     * @param UserModel $user
30
     *
31
     * @return object
32
     */
33
    protected function getCreateUserEvent(UserModel $user)
34
    {
35
        return Yii::createObject(['class' => CreateUserEvent::class, 'user' => $user]);
36
    }
37
}
38