SocialAuthenticator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 50
rs 10
c 0
b 0
f 0
ccs 9
cts 9
cp 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isEnabled() 0 4 1
A drivers() 0 4 1
A enabledDrivers() 0 6 1
A isSupported() 0 4 1
1
<?php namespace Arcanedev\LaravelAuth\Services;
2
3
use Illuminate\Support\Collection;
4
5
/**
6
 * Class     SocialAuthenticator
7
 *
8
 * @package  Arcanedev\LaravelAuth\Services
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class SocialAuthenticator
12
{
13
    /* -----------------------------------------------------------------
14
     |  Main Methods
15
     | -----------------------------------------------------------------
16
     */
17
    /**
18
     * Check if social authentication is enabled.
19
     *
20
     * @return bool
21
     */
22 213
    public static function isEnabled()
23
    {
24 213
        return config('laravel-auth.socialite.enabled', false);
25
    }
26
27
    /**
28
     * Get the supported drivers.
29
     *
30
     * @return \Illuminate\Support\Collection
31
     */
32 9
    public static function drivers()
33
    {
34 9
        return Collection::make(config('laravel-auth.socialite.drivers', []));
35
    }
36
37
    /**
38
     * Get the enabled drivers.
39
     *
40
     * @return \Illuminate\Support\Collection
41
     */
42 6
    public static function enabledDrivers()
43
    {
44
        return static::drivers()->filter(function ($driver) {
45 6
            return $driver['enabled'];
46 6
        });
47
    }
48
49
    /**
50
     * Check if the given driver is supported.
51
     *
52
     * @param  string  $driver
53
     *
54
     * @return bool
55
     */
56 3
    public static function isSupported($driver)
57
    {
58 3
        return static::enabledDrivers()->has($driver);
59
    }
60
}
61