Social::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Acacha\LaravelSocial\Console\Commands;
4
5
use Acacha\LaravelSocial\Contracts\ConfigureSocialServicesFactory;
6
use Acacha\LaravelSocial\Services\ConfigureSocialServicesManager;
7
use Illuminate\Console\Command;
8
9
/**
10
 * Class Social.
11
 *
12
 * @package Acacha\Social\Console\Commands
13
 */
14
class Social extends Command
15
{
16
    /**
17
     * The name and signature of the console command.
18
     *
19
     * @var string
20
     */
21
    protected $signature = 'acacha:social';
22
23
    /**
24
     * The console command description.
25
     *
26
     * @var string
27
     */
28
    protected $description = 'Configure social login in your Laravel app';
29
30
    /**
31
     * Social network configurator service.
32
     *
33
     * @var ConfigureSocialServicesFactory
34
     */
35
    protected $configurator;
36
37
    /**
38
     * Create a new command instance.
39
     *
40
     * @param ConfigureSocialServicesFactory $configurator
41
     */
42
    public function __construct(ConfigureSocialServicesFactory $configurator)
43
    {
44
        $this->configurator = $configurator;
45
        parent::__construct();
46
    }
47
48
    /**
49
     * Execute the console command.
50
     *
51
     * @return mixed
52
     */
53
    public function handle()
54
    {
55
        $continue = true;
56
        while ($continue) {
57
            $socialNetwork =
58
                $this->choice('Which social network you wish to configure?',
59
                    ConfigureSocialServicesManager::$socialNetworks, 0);
60
            $this->configurator->driver($socialNetwork)->command($this)->execute();
0 ignored issues
show
Bug introduced by
The method command() does not seem to exist on object<Acacha\LaravelSoc...ntracts\SocialProvider>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
61
            $continue = $this->confirm('Do you wish to configure other social networks?', true);
62
        }
63
    }
64
}
65