Issues (64)

console/commands/ROCache.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Irfa\RajaOngkir\Console\Commands;
4
5
use Illuminate\Console\Command;
0 ignored issues
show
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
use Irfa\RajaOngkir\Caching\ROCache as CacheCMD;
8
9
class ROCache extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'raja-ongkir:cache {name}';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Create cache RajaOngkir';
24
25
    /**
26
     * Create a new command instance.
27
     *
28
     * @return void
29
     */
30
    public function __construct()
31
    {
32
        parent::__construct();
33
    }
34
35
    /**
36
     * Execute the console command.
37
     *
38
     * @return mixed
39
     */
40
    public function handle()
41
    {
42
        if($this->argument('name') == "all"){
43
            $this->all();
44
        } elseif($this->argument('name') == "city"){
45
            RajaOngkir::cachingCity();
46
        } elseif($this->argument('name') == "province"){
47
             RajaOngkir::cachingProvince();
48
        } elseif($this->argument('name') == "subdistrict"){
49
             RajaOngkir::cachingSubDistrict();
50
        } elseif($this->argument('name') == "clear"){
51
             CacheCMD::clearCache();
52
        } elseif($this->argument('name') == "refresh"){
53
             CacheCMD::refresh();
0 ignored issues
show
The method refresh() does not exist on Irfa\RajaOngkir\Caching\ROCache. ( Ignorable by Annotation )

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

53
             CacheCMD::/** @scrutinizer ignore-call */ 
54
                       refresh();

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...
54
        } else{
55
             $this->line('<fg=yellow>valid input is  all, clear, refresh, city, province and subdistrict.');
56
        }
57
    }
58
    private function all(){
59
        $this->line("|_   _|    / _|               | ___ \    (_)       |  _  |           | |  (_)     
60
  | | _ __| |_ __ _   ______  | |_/ /__ _ _  __ _  | | | |_ __   __ _| | ___ _ __ 
61
  | || '__|  _/ _` | |______| |    // _` | |/ _` | | | | | '_ \ / _` | |/ / | '__|
62
 _| || |  | || (_| |          | |\ \ (_| | | (_| | \ \_/ / | | | (_| |   <| | |   
63
 \___/_|  |_| \__,_|          \_| \_\__,_| |\__,_|  \___/|_| |_|\__, |_|\_\_|_|   
64
                                        _/ |                     __/ |            
65
                                       |__/                     |___/             ".PHP_EOL);
66
        echo "---------------------".PHP_EOL;
67
        echo"Province Caching".PHP_EOL;
68
        echo"---------------------".PHP_EOL;
69
        RajaOngkir::cachingProvince();
70
        echo PHP_EOL."---------------------".PHP_EOL;
71
        sleep(1);//Cooling Down
72
        echo"City Caching".PHP_EOL;
73
        echo "---------------------".PHP_EOL;
74
        RajaOngkir::cachingCity();
75
        echo PHP_EOL."---------------------".PHP_EOL;
76
        sleep(1);//Cooling Down
77
        echo"Subdistrict Caching".PHP_EOL;
78
        echo "---------------------".PHP_EOL;
79
        RajaOngkir::cachingSubDistrict();
80
        echo PHP_EOL."---------------------".PHP_EOL;
81
    }
82
    private function refresh(){
83
        echo "---------------------".PHP_EOL;
84
        echo"Refresh Cache".PHP_EOL;
85
        echo"---------------------".PHP_EOL;
86
        CacheCMD::clearCache();
87
        echo "---------------------".PHP_EOL;
88
        echo"Province Caching".PHP_EOL;
89
        echo"---------------------".PHP_EOL;
90
        RajaOngkir::cachingProvince();
91
        echo PHP_EOL."---------------------".PHP_EOL;
92
        sleep(1);//Cooling Down
93
        echo"City Caching".PHP_EOL;
94
        echo "---------------------".PHP_EOL;
95
        RajaOngkir::cachingCity();
96
        echo PHP_EOL."---------------------".PHP_EOL;
97
        sleep(1);//Cooling Down
98
        echo"Subdistrict Caching".PHP_EOL;
99
        echo "---------------------".PHP_EOL;
100
        RajaOngkir::cachingSubDistrict();
101
        echo PHP_EOL."---------------------".PHP_EOL;
102
    }
103
}
104