public function validate($code): bool
    {
        $codeLength = strlen($code);

        return ctype_digit($code) && $codeLength == $this->config['total_digits'] && strlen($code) <= 6;
    }
public function validate($code): bool
    {
        $codeLength = strlen($code);

        return ctype_digit($code) && $codeLength == $this->config['total_digits'] && strlen($code) <= 6;
    }
public function validate ( $ code ) : bool { $ codeLength = strlen ( $ code ) ; return ctype_digit ( $ code ) && $ codeLength == $ this -> config [ 'total_digits' ] && strlen ( $ code ) <= 6 ; }
Check if given code is valid.

@param $code

@return bool
Check if given code is valid .