Test Setup Failed
Push — master ( dcfdf2...6863da )
by guillaume
16:18 queued 10:15
created

RealSocialiteGateway::user()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
nc 1
nop 1
dl 0
loc 11
rs 10
c 1
b 0
f 0
1
<?php
2
3
4
namespace App\Src\UseCases\Infra\Gateway\Real;
5
6
7
use App\Src\UseCases\Domain\Auth\SocialiteUser;
8
use App\Src\UseCases\Infra\Gateway\Auth\SocialiteGateway;
9
use Laravel\Socialite\Facades\Socialite;
10
11
class RealSocialiteGateway implements SocialiteGateway
12
{
13
    public function user(string $provider): SocialiteUser
14
    {
15
        $user = Socialite::driver($provider)->stateless()->user();
0 ignored issues
show
Bug introduced by
The method stateless() does not exist on Laravel\Socialite\Contracts\Provider. It seems like you code against a sub-type of Laravel\Socialite\Contracts\Provider such as Laravel\Socialite\Two\AbstractProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

15
        $user = Socialite::driver($provider)->/** @scrutinizer ignore-call */ stateless()->user();
Loading history...
16
17
        $email = $user->getEmail();
18
        $firstname = $user->user['given_name'];
19
        $lastname = $user->user['family_name'];
20
        $id = $user->getId();
21
        $picture = $user->user['picture'];
22
23
        return new SocialiteUser($id, $email, $firstname, $lastname, $picture);
24
    }
25
}
26