Code Duplication    Length = 4-5 lines in 4 locations

src/components/ProfileValidateComponent.php 1 location

@@ 304-308 (lines=5) @@
301
                '\\' . $modelClass->getShortName().' class  must be implemented from yii\db\ActiveRecordInterface.');
302
        }
303
304
        if (!($model instanceof IdentityInterface)){
305
            $modelClass = (new\ReflectionClass($model));
306
            throw new InvalidConfigException($modelClass->getNamespaceName() .
307
                '\\' . $modelClass->getShortName().' class  must be implemented from yii\web\IdentityInterface.');
308
        }
309
310
        /** @var ModelInterface $object */
311
        $object = Yii::createObject([

src/controllers/BaseController.php 1 location

@@ 389-392 (lines=4) @@
386
387
        $modelObject = $this->getNewModel();
388
389
        if (!method_exists($modelObject, 'findOne')){
390
            $class = (new\ReflectionClass($modelObject));
391
            throw new UnknownMethodException('Method findOne does not exists in ' . $class->getNamespaceName() . '\\' . $class->getShortName().' class.');
392
        }
393
394
        $result = call_user_func([
395
            $modelObject,

src/models/ProfileValidate.php 2 locations

@@ 319-323 (lines=5) @@
316
     */
317
    public function setProfileModel($model): void
318
    {
319
        if (!($model instanceof ActiveRecordInterface)){
320
            $modelClass = (new\ReflectionClass($model));
321
            throw new InvalidConfigException($modelClass->getNamespaceName() .
322
                '\\' . $modelClass->getShortName().' class  must be implemented from yii\db\ActiveRecordInterface.');
323
        }
324
325
        if (!($model instanceof IdentityInterface)){
326
            $modelClass = (new\ReflectionClass($model));
@@ 325-329 (lines=5) @@
322
                '\\' . $modelClass->getShortName().' class  must be implemented from yii\db\ActiveRecordInterface.');
323
        }
324
325
        if (!($model instanceof IdentityInterface)){
326
            $modelClass = (new\ReflectionClass($model));
327
            throw new InvalidConfigException($modelClass->getNamespaceName() .
328
                '\\' . $modelClass->getShortName().' class  must be implemented from yii\web\IdentityInterface.');
329
        }
330
331
        $this->profileModel = $model;
332
    }