Issues (23)

src/Console/Commands/CheckLockedCommands.php (3 issues)

1
<?php
2
3
namespace Irfa\Lockout\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Irfa\Lockout\Func\Core,Lockout;
0 ignored issues
show
The type Lockout 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...
7
use Symfony\Component\Console\Helper\Table;
8
9
class CheckLockedCommands extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'lockout:is-locked {username}';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Check 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)
0 ignored issues
show
The parameter $core is not used and could be removed. ( Ignorable by Annotation )

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

40
    public function handle(/** @scrutinizer ignore-unused */ Core $core)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
41
    { 
42
        $username = $this->argument('username');
43
        $lock = Lockout::isLocked($username);
44
            $table = new Table($this->output);
45
            if($lock){
46
                $table->setRows([
47
                        ['<fg=yellow>'.$username.' is locked',]]);
0 ignored issues
show
Are you sure $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

47
                        ['<fg=yellow>'./** @scrutinizer ignore-type */ $username.' is locked',]]);
Loading history...
48
                 $table->render();
49
                $this->line('<fg=default>Run <fg=cyan>php artisan lockout:unlock '.$username.'<fg=default> to unlock account.'); 
50
            } else{
51
                 $table->setRows([
52
                        ['<fg=green>'.$username.' is unlocked',]]);
53
                  $table->render();
54
                         $this->line('<fg=default>Run <fg=cyan>php artisan lockout:lock '.$username.'<fg=default> to lock account.');  
55
            }   
56
                       
57
                // $this->line('<fg=yellow>Valid input is  lock, unlock, and attemps.');
58
        
59
    }
60
    
61
}