Issues (44)

app/Console/Commands/CreateNewJudger.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App\Console\Commands;
4
5
use App\Exceptions\ApiException;
6
use App\Services\JudgerService;
7
use Illuminate\Console\Command;
8
9
class CreateNewJudger extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'judger:new {name}';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'create new judger';
24
25
    public function handle()
26
    {
27
        $name = $this->argument('name');
28
        if ($name) {
29
            try {
30
                $judger = app(JudgerService::class)->newJudger($name);
0 ignored issues
show
It seems like $name can also be of type array; however, parameter $name of App\Services\JudgerService::newJudger() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

30
                $judger = app(JudgerService::class)->newJudger(/** @scrutinizer ignore-type */ $name);
Loading history...
31
                $this->info("Create New Judger {$name}, Code: ".$judger->code);
32
            } catch (ApiException $e) {
33
                $this->error($e->getMessage());
34
            }
35
        }
36
    }
37
}
38