Issues (23)

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

1
<?php
2
3
namespace Irfa\Lockout\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Symfony\Component\Console\Helper\Table;
7
8
class LockInfoPackage extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'lockout:info';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Package Information';
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
        $this->informasi();
42
    }
43
44
    private function informasi(){
45
            $this->line(" _____      __             _                _               _   
46
|_   _|    / _|           | |              | |             | |  
47
  | | _ __| |_ __ _ ______| |     ___   ___| | _____  _   _| |_ 
48
  | || '__|  _/ _` |______| |    / _ \ / __| |/ / _ \| | | | __|
49
 _| || |  | || (_| |      | |___| (_) | (__|   < (_) | |_| | |_ 
50
 \___/_|  |_| \__,_|      \_____/\___/ \___|_|\_\___/ \__,_|\__|".PHP_EOL);
51
52
    $this->line('-------------------------------------------------------------------------------');
53
    $this->line('Laravel Account Lockout');
54
    $this->line('Version 1.0.0 (2020)');
55
    $this->line('<fg=cyan>https://github.com/irfaardy/lockout-account');
56
    $conf = config('irfa.lockout');
57
58
        $this->line('<fg=default>-------------------------------------------------------------------------------');
59
         $this->line('<fg=yellow>Commands');
60
          $table = new Table($this->output);
61
            $table->setRows([
62
                ['<fg=cyan>php artisan lockout:lock {username}','<fg=default>locking account'],
63
                ['<fg=cyan>php artisan lockout:unlock {username}','<fg=default>unlocking account'],
64
                ['<fg=cyan>php artisan lockout:check {username}','<fg=default>checking account with details'],
65
                ['<fg=cyan>php artisan lockout:is-locked {username}','<fg=default>checking account (return boolean)'],
66
                ['<fg=cyan>php artisan lockout:clear','<fg=default>unlocking all account']]
67
            );
68
          $table->render();
69
         $this->line('<fg=default>-------------------------------------------------------------------------------');
70
        $this->line('<fg=yellow>Configuration');
71
    foreach($conf as $key => $val){
72
        if(is_array($val)){
73
            foreach($val as $v){
74
                $vl .= $v.", ";
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $vl does not seem to be defined for all execution paths leading up to this point.
Loading history...
75
            }
76
        } else{
77
                $vl = $val;
78
            }
79
            $row[] = ['<fg=default>'.$key,' <fg=cyan>'.$vl];
80
        }
81
        // dd($row);
82
          $table = new Table($this->output);
83
            $table->setRows($row);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $row seems to be defined by a foreach iteration on line 71. Are you sure the iterator is never empty, otherwise this variable is not defined?
Loading history...
84
                        $table->render();
85
    }
86
    
87
   
88
}
89