Issues (23)

src/Console/Commands/LockCommands.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Irfa\Lockout\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Irfa\Lockout\Func\Core;
7
use Symfony\Component\Console\Helper\Table;
8
9
class LockCommands extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'lockout:lock {username}';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Lock Account';
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(Core $core)
41
    {
42
        $this->line('Locking '.$this->argument('username').'...');
0 ignored issues
show
Are you sure $this->argument('username') of type string|string[] can be used in concatenation? ( Ignorable by Annotation )

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

42
        $this->line('Locking './** @scrutinizer ignore-type */ $this->argument('username').'...');
Loading history...
43
        if($core->lock_account($this->argument('username'))!="error"){
0 ignored issues
show
It seems like $this->argument('username') can also be of type string[]; however, parameter $username of Irfa\Lockout\Func\Core::lock_account() 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

43
        if($core->lock_account(/** @scrutinizer ignore-type */ $this->argument('username'))!="error"){
Loading history...
44
            $table = new Table($this->output);
45
            $table->setRows([
46
                        ['<fg=green>'.$this->argument('username').' successfully locked.'],
47
                       
48
                    ]);
49
                        $table->render();
50
        } else{
51
                $this->line('<fg=red> Locking failed.');
52
        }
53
    }
54
    
55
}
56