Passed
Push — master ( ee094a...0581a6 )
by IRFA
02:19 queued 11s
created

ROInfoPackage   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 28
c 1
b 0
f 0
dl 0
loc 67
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 20 6
A informasi() 0 13 1
1
<?php
2
3
namespace Irfa\RajaOngkir\Console\Commands;
4
5
use Illuminate\Console\Command;
0 ignored issues
show
Bug introduced by
The type Illuminate\Console\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Irfa\RajaOngkir\Ongkir\Ongkir as RajaOngkir;
7
8
class ROInfoPackage extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'raja-ongkir {cmd}';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Option';
23
24
    /**
25
     * Create a new command instance.
26
     *
27
     * @return void
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
        if($this->argument('cmd') == "version" || $this->argument('cmd') == "v" ){
42
            $this->informasi();
43
        } elseif($this->argument('cmd') == "key"){
44
            $this->line('Api Key: '.config('irfa.rajaongkir.api_key'));
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

44
            $this->line('Api Key: './** @scrutinizer ignore-call */ config('irfa.rajaongkir.api_key'));
Loading history...
45
        } elseif($this->argument('cmd') == "type"){
46
            $this->line('Account Type: '.config('irfa.rajaongkir.account_type'));
47
        }  elseif($this->argument('cmd') == "info"){
48
             $this->informasi();
49
            $this->line('-------------------------------------------------------------------------------');
50
            $this->line('Account Type: '.config('irfa.rajaongkir.account_type'));
51
            $this->line('Api Key: '.config('irfa.rajaongkir.api_key'));
52
            $this->line('Api Version: '.config('irfa.rajaongkir.api_version'));
53
            $this->line('Province Table: '.config('irfa.rajaongkir.province_table'));
54
            $this->line('City Table: '.config('irfa.rajaongkir.city_table'));
55
            $this->line('Subdistrict Table: '.config('irfa.rajaongkir.subdistrict_table'));
56
            $this->line('Cache Type: '.config('irfa.rajaongkir.cache_type'));
57
        } else{
58
             $this->line('<fg=yellow>valid input is  version, key, type, info,and v.');
59
        }
60
    }
61
62
    private function informasi(){
63
         $this->line(" |_   _|     / _|               |  __ \     (_)        / __ \            | |  (_)     
64
   | |  _ __| |_ __ _   ______  | |__) |__ _ _  __ _  | |  | |_ __   __ _| | ___ _ __ 
65
   | | | '__|  _/ _` | |______| |  _  // _` | |/ _` | | |  | | '_ \ / _` | |/ / | '__|
66
  _| |_| |  | || (_| |          | | \ \ (_| | | (_| | | |__| | | | | (_| |   <| | |   
67
 |_____|_|  |_| \__,_|          |_|  \_\__,_| |\__,_|  \____/|_| |_|\__, |_|\_\_|_|   
68
                                           _/ |                      __/ |            
69
                                          |__/                      |___/             ".PHP_EOL);
70
71
    $this->line('-------------------------------------------------------------------------------');
72
    $this->line('Raja Ongkir');
73
    $this->line('Version 1.6.0 (2020)');
74
    $this->line('https://github.com/irfaardy/raja-ongkir');
75
    }
76
   
77
}
78