SocialProvider::name()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 1
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