LaravelSocialite   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 15
c 2
b 1
f 0
dl 0
loc 34
rs 10
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A socialiteButtons() 0 25 5
1
<?php
2
3
namespace Mckenziearts\LaravelOAuth;
4
5
class LaravelSocialite
6
{
7
    /**
8
     * This function construct the socialite buttons with activated providers.
9
     *
10
     * @param string $type
11
     *
12
     * @return string
13
     */
14
    public function socialiteButtons(string $type)
15
    {
16
        $providers = config('laravel-oauth.providers');
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
        $providers = /** @scrutinizer ignore-call */ config('laravel-oauth.providers');
Loading history...
17
        $buttons = '<p class="socialite-buttons">';
18
19
        foreach ($providers as $provider => $status) {
20
            if ($status === true) {
21
                if (config('laravel-oauth.buttons.outline') === true) {
22
                    $buttons .= '<a href="'.url("/auth/$provider").'" class="'.config('laravel-oauth.buttons.class').' btn-outline-'.$provider.'">';
0 ignored issues
show
Bug introduced by
The function url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
                    $buttons .= '<a href="'./** @scrutinizer ignore-call */ url("/auth/$provider").'" class="'.config('laravel-oauth.buttons.class').' btn-outline-'.$provider.'">';
Loading history...
23
                } else {
24
                    $buttons .= '<a href="'.url("/auth/$provider").'" class="'.config('laravel-oauth.buttons.class').' btn-'.$provider.'">';
25
                }
26
27
                if (config('laravel-oauth.buttons.icon') === true) {
28
                    $buttons .= "<i class='social-{$provider}'></i>";
29
                }
30
31
                $buttons .= trans("laravel-oauth::word.{$type}", ['provider' => $provider]);
0 ignored issues
show
Bug introduced by
The function trans was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
                $buttons .= /** @scrutinizer ignore-call */ trans("laravel-oauth::word.{$type}", ['provider' => $provider]);
Loading history...
32
                $buttons .= '</a>';
33
            }
34
        }
35
36
        $buttons .= '</p>';
37
38
        return $buttons;
39
    }
40
}
41