ProfileValidateComponent   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 21
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A setModel() 0 10 1
1
<?php
2
3
namespace Itstructure\RbacModule\components;
4
5
use Yii;
6
use yii\base\{Model, InvalidConfigException};
7
use Itstructure\RbacModule\{
8
    interfaces\ModelInterface,
9
    interfaces\ValidateComponentInterface,
10
    models\ProfileValidate
11
};
12
13
/**
14
 * Class ProfileValidateComponent
15
 * Component class for validation user fields.
16
 *
17
 * @package Itstructure\RbacModule\components
18
 */
19
class ProfileValidateComponent extends BaseValidateComponent implements ValidateComponentInterface
20
{
21
    /**
22
     * Set a user model for ProfileValidateComponent validation model.
23
     *
24
     * @param Model $model
25
     *
26
     * @throws InvalidConfigException
27
     *
28
     * @return ModelInterface
29
     */
30
    public function setModel(Model $model): ModelInterface
31
    {
32
        /** @var ModelInterface $object */
33
        $object = Yii::createObject([
34
            'class' => ProfileValidate::class,
35
            'profileModel' => $model,
36
            'authManager' => $this->authManager,
37
        ]);
38
39
        return $object;
40
    }
41
}
42