SocialProviderManager::createGoogleDriver()   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
use Acacha\LaravelSocial\Contracts\Factory;
6
use Illuminate\Support\Manager;
7
8
/**
9
 * Class SocialProviderManager.
10
 *
11
 * @package Acacha\LaravelSocial\SocialProviders
12
 */
13
class SocialProviderManager extends Manager implements Factory
14
{
15
16
     /**
17
     * SocialProviderManager constructor.
18
     *
19
     * @param \Illuminate\Foundation\Application $app
20
     */
21
    public function __construct(\Illuminate\Foundation\Application $app)
22
    {
23
        parent::__construct($app);
24
    }
25
26
    /**
27
     * Get the default driver name.
28
     *
29
     * @return string
30
     */
31
    public function getDefaultDriver()
32
    {
33
        return $this->app['config']['social.provider'];
34
    }
35
36
    /**
37
     * Create an instance of the "github" social provider driver.
38
     *
39
     */
40
    protected function createGithubDriver()
41
    {
42
        return $this->buildProvider('github');
43
    }
44
45
    /**
46
     * Create an instance of the "facebook" social provider driver.
47
     *
48
     */
49
    protected function createFacebookDriver()
50
    {
51
        return $this->buildProvider('facebook');
52
    }
53
54
    /**
55
     * Create an instance of the "google" social provider driver.
56
     *
57
     */
58
    protected function createGoogleDriver()
59
    {
60
        return $this->buildProvider('google');
61
    }
62
63
    /**
64
     * Create an instance of the "twitter" social provider driver.
65
     *
66
     */
67
    protected function createTwitterDriver()
68
    {
69
        return $this->buildProvider('twitter');
70
    }
71
72
    /**
73
     * Create an instance of the "linkedin" social provider driver.
74
     *
75
     */
76
    protected function createLinkedinDriver()
77
    {
78
        return $this->buildProvider('linkedin');
79
    }
80
81
    /**
82
     * Build provider.
83
     *
84
     * @param $provider
85
     * @return SocialProvider
86
     */
87
    public function buildProvider($provider)
88
    {
89
        return resolve($this->getProvider($provider));
90
    }
91
92
    /**
93
     * Get provider.
94
     *
95
     * @param $provider
96
     * @return string
97
     */
98
    private function getProvider($provider)
99
    {
100
        return $provider = ucfirst($provider) . 'SocialProvider';
0 ignored issues
show
Unused Code introduced by
$provider is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
101
    }
102
}
103