SocialProvider::user()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Acacha\LaravelSocial\SocialProviders;
4
5
/**
6
 * Class SocialProvider.
7
 *
8
 * @package Acacha\LaravelSocial
9
 */
10
abstract class SocialProvider implements \Acacha\LaravelSocial\Contracts\SocialProvider
11
{
12
    /**
13
     * Laravel Socialite.
14
     *
15
     * @var
16
     */
17
    public $socialite;
18
19
    /**
20
     * SocialProvider constructor.
21
     *
22
     * @param $socialite
23
     */
24
    public function __construct(\Laravel\Socialite\Contracts\Factory $socialite)
25
    {
26
        $this->socialite = $socialite;
27
    }
28
29
30
    /**
31
     * Redirect the user to the authentication page for the provider.
32
     *
33
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
34
     */
35
    public function redirect()
36
    {
37
        return $this->socialite->driver($this->name())->redirect();
38
    }
39
40
    /**
41
     * Redirect the user to the authentication page for the provider.
42
     *
43
     * @return \Laravel\Socialite\Contracts\User
44
     */
45
    public function user()
46
    {
47
        return $this->socialite->driver($this->name())->user();
48
    }
49
50
    /**
51
     * The name of social provider.
52
     *
53
     * @return mixed
54
     */
55
    abstract public function name();
56
}
57