Completed
Push — master ( 6376e7...c557af )
by Mahmoud
04:19
created

Controller::webAuthenticateAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace App\Containers\SocialAuthentication\UI\WEB\Controllers;
4
5
use App\Containers\SocialAuthentication\Actions\SocialLoginAction;
6
use App\Containers\User\UI\API\Transformers\UserTransformer;
7
use App\Port\Controller\Abstracts\PortWebController;
8
use Laravel\Socialite\Facades\Socialite;
9
10
/**
11
 * Class Controller
12
 *
13
 * @author  Mahmoud Zalt  <[email protected]>
14
 */
15
class Controller extends PortWebController
16
{
17
18
    /**
19
     * WEB Callback handler only, all the others are for API from Mobile.
20
     *
21
     * @param                                                                $provider
22
     * @param \App\Containers\SocialAuthentication\Actions\SocialLoginAction $action
23
     *
24
     * @return  \Dingo\Api\Http\Response
25
     */
26
    public function webAuthenticateAll($provider, SocialLoginAction $action)
27
    {
28
        $user = $action->run($provider);
29
30
        return $this->response->item($user, new UserTransformer());
0 ignored issues
show
Bug introduced by
The property response does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
31
    }
32
33
    /**
34
     * @param $provider
35
     *
36
     * @return  mixed
37
     */
38
    public function webRedirectAll($provider)
39
    {
40
        return Socialite::driver($provider)->redirect();
41
    }
42
}
43