Code Duplication    Length = 5-5 lines in 2 locations

src/controllers/SiteController.php 1 location

@@ 95-99 (lines=5) @@
92
    {
93
        $attributes = $client->getUserAttributes();
94
        $user = new User();
95
        foreach ($user->attributes() as $k) {
96
            if (isset($attributes[$k])) {
97
                $user->{$k} = $attributes[$k];
98
            }
99
        }
100
        $user->save();
101
        Yii::$app->user->login($user, Yii::$app->params['login_duration'] ?: 3600 * 24 * 30);
102
    }

src/logic/Impersonator.php 1 location

@@ 64-68 (lines=5) @@
61
    {
62
        $attributes = $client->getUserAttributes();
63
        $identity = new User();
64
        foreach ($identity->attributes() as $k) {
65
            if (isset($attributes[$k])) {
66
                $identity->{$k} = $attributes[$k];
67
            }
68
        }
69
        if ($this->user->getId() === $identity->getId()) {
70
            return;
71
        }