Issues (23)

src/Console/Commands/UnlockCommands.php (1 issue)

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 UnlockCommands extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'lockout:unlock {username}';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Unlock 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
        $ret = $core->unlock_account($this->argument('username'));
0 ignored issues
show
It seems like $this->argument('username') can also be of type string[]; however, parameter $username of Irfa\Lockout\Func\Core::unlock_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

42
        $ret = $core->unlock_account(/** @scrutinizer ignore-type */ $this->argument('username'));
Loading history...
43
            $table = new Table($this->output);
44
                $read_enc = json_decode( $ret);
45
                if(!empty($read_enc)){
46
                    $time = $read_enc->last_attemps;
47
                    $attemps = $read_enc->attemps;
48
                    $ip = $read_enc->ip;
49
                    $table->setRows([
50
                            ['<fg=cyan>Login attemps',  $attemps],
51
                            ['<fg=cyan>Last login attemps',$time],
52
                            ['<fg=cyan>Last IP Address',empty(end($ip))? "unknown":end($ip)],
53
                            ['<fg=cyan>Unlocked at',date('Y-m-d H:i:s', time())],
54
                        ]);
55
                            $table->render();
56
                }
57
                // $this->line('<fg=yellow>Valid input is  lock, unlock, and attemps.');
58
        
59
    }
60
    
61
}