Issues (23)

src/Func/Lockout.php (1 issue)

Labels
Severity
1
<?php 
2
namespace Irfa\Lockout\Func;
3
4
use Irfa\Lockout\Func\Core;
5
use View;
6
7
class Lockout extends Core {
8
	
9
    public function unlock($username){
10
        if(is_array($username)){
11
            foreach($username as $key){
12
                $this->_unlock($key);
13
            }
14
        } else{
15
            $this->_unlock($username);
16
        }
17
        return true;
18
    }
19
  	public function isLocked($username){
20
  		return $this->is_locked($username);
21
  	}
22
    public function message(){
23
        return $this->showMessage();
24
    }
25
    public function lock($username){
26
        if(is_array($username)){
27
            foreach($username as $key){
28
                    $this->_lock($key);
29
            }
30
        } else{
31
                $this->_lock($username);
32
        }
33
        return true;
34
    }
35
    public function check($username) {	 
36
        $ret = null;
37
        if(is_array($username)){
38
            foreach($username as $key){
39
                $get = $this->_check($key);
40
                if(!empty($get)){
41
                    $ret[] = $get;
42
                }
43
            }
44
        } else{
45
                $ret = $this->_check($username);
46
        }
47
        $ret = json_encode($ret);
48
        return json_decode($ret);
49
    }
50
    public function clearLocked(){
51
        return $this->clear_all();
52
    }
53
    
54
    private function _unlock($username){
55
        $this->unlock_account($username);
56
    }
57
    private function _lock($username){
58
        $this->lock_account($username);
59
    }
60
    private function _check($username){
61
        return json_decode($this->check_account($username),true);
0 ignored issues
show
It seems like $this->check_account($username) can also be of type false; however, parameter $json of json_decode() 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

61
        return json_decode(/** @scrutinizer ignore-type */ $this->check_account($username),true);
Loading history...
62
    }
63
}
64