Completed
Push — master ( c5ab20...ada58a )
by Nikan
02:45 queued 01:44
created

LaravelCafebazaarConsole   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 43
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 12 2
1
<?php
2
3
namespace Nikandlv\LaravelCafebazaar;
4
5
use App\User;
6
use App\DripEmailer;
7
use Illuminate\Console\Command;
8
9
class LaravelCafebazaarConsole extends Command {
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'Cafebazaar {action}';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Cafebazaar console commands';
23
24
    /**
25
     * Create a new command instance.
26
     *
27
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
28
     */
29
    public function __construct()
30
    {
31
        parent::__construct();
32
    }
33
34
    /**
35
     * Execute the console command.
36
     *
37
     * @return mixed
38
     */
39
    public function handle()
40
    {
41
        $action = $this->argument('action');
42
        $client_id = config('laravel-cafebazaar.client_id');
43
        $redirect_uri = config('laravel-cafebazaar.redi$redirect_uri');
44
        switch($action) {
45
            case 'code':
46
                echo "Visit this and grant access";
47
                echo "https://pardakht.cafebazaar.ir/devapi/v2/auth/authorize/?response_type=code&access_type=offline&redirect_uri=$redirect_uri&client_id=$client_id\n";
48
                break;
49
        }
50
    }
51
}