Code Duplication    Length = 5-5 lines in 2 locations

src/logic/Impersonator.php 1 location

@@ 72-76 (lines=5) @@
69
    {
70
        $attributes = $client->getUserAttributes();
71
        $identity = new User();
72
        foreach ($identity->attributes() as $k) {
73
            if (isset($attributes[$k])) {
74
                $identity->{$k} = $attributes[$k];
75
            }
76
        }
77
        if ($this->user->getId() === $identity->getId()) {
78
            return;
79
        }

src/controllers/SiteController.php 1 location

@@ 110-114 (lines=5) @@
107
    {
108
        $attributes = $client->getUserAttributes();
109
        $user = new User();
110
        foreach ($user->attributes() as $k) {
111
            if (isset($attributes[$k])) {
112
                $user->{$k} = $attributes[$k];
113
            }
114
        }
115
        $user->save();
116
        Yii::$app->user->login($user, Yii::$app->params['login_duration'] ?: 3600 * 24 * 30);
117
    }