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

RealSocialiteGateway   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 13
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A user() 0 11 1
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