Code Duplication    Length = 13-14 lines in 2 locations

src/Providers/AbstractProvider.php 1 location

@@ 186-199 (lines=14) @@
183
    /**
184
     * {@inheritdoc}
185
     */
186
    public function user(AccessTokenInterface $token = null)
187
    {
188
        if (is_null($token) && $this->hasInvalidState()) {
189
            throw new InvalidStateException();
190
        }
191
192
        $token = $token ?: $this->getAccessToken($this->getCode());
193
194
        $user = $this->getUserByToken($token);
195
196
        $user = $this->mapUserToObject($user)->merge(['original' => $user]);
197
198
        return $user->setToken($token)->setProviderName($this->getName());
199
    }
200
201
    /**
202
     * Set redirect url.

src/Providers/FeiShuProvider.php 1 location

@@ 130-142 (lines=13) @@
127
     *
128
     * @return array|mixed
129
     */
130
    public function user(AccessTokenInterface $token = null)
131
    {
132
        if (is_null($token) && $this->hasInvalidState()) {
133
            throw new InvalidStateException();
134
        }
135
136
        $token = $token ?: $this->getAccessToken();
137
138
        $user = $this->getUserByToken($token, $this->getCode());
139
        $user = $this->mapUserToObject($user)->merge(['original' => $user]);
140
141
        return $user->setToken($token)->setProviderName($this->getName());
142
    }
143
144
    /**
145
     * 通过 token 获取用户信息.