Completed
Push — 1 ( fdc87b...27ddc3 )
by Morven
01:40
created

Users::addNewUserGroup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/**
4
 * Root class for users, this will mostly be used to store generic
5
 * config, but will probably be extended in future to provide additional
6
 * functionality.
7
 *
8
 * @package Users
9
 * @author  i-lateral <[email protected]>
10
 */
11
class Users extends Object
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
12
{
13
14
    /**
15
     * Minimum character length of the password required
16
     * on registration/account editing
17
     *
18
     * @var    int
19
     * @config
20
     */
21
    private static $password_min_length = 6;
0 ignored issues
show
Unused Code introduced by
The property $password_min_length is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
22
23
    /**
24
     * Maximum character length of the password required
25
     * on registration/account editing
26
     *
27
     * @var    int
28
     * @config
29
     */
30
    private static $password_max_length = 16;
0 ignored issues
show
Unused Code introduced by
The property $password_max_length is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
31
32
    /**
33
     * Enforces strong password (at least one digit and one alphanumeric
34
     * character) on registration/account editing
35
     *
36
     * @var    boolean
37
     * @config
38
     */
39
    private static $password_require_strong = false;
0 ignored issues
show
Unused Code introduced by
The property $password_require_strong is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
40
41
    /**
42
     * Stipulate if a user requires verification. NOTE this does not
43
     * actually deny the user the ability to login, it only alerts them
44
     * that they need validiation
45
     *
46
     * @var    boolean
47
     * @config
48
     */
49
    private static $require_verification = true;
0 ignored issues
show
Unused Code introduced by
The property $require_verification is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
50
51
    /**
52
     * Stipulate whether to send a verification email to users after
53
     * registration
54
     *
55
     * @var    boolean
56
     * @config
57
     */
58
    private static $send_verification_email = false;
0 ignored issues
show
Unused Code introduced by
The property $send_verification_email is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
59
60
    /**
61
     * Stipulate the sender address for emails sent from this module. If
62
     * not set, use the default @Email.admin_email instead.
63
     *
64
     * @var    string
65
     * @config
66
     */
67
    private static $send_email_from;
0 ignored issues
show
Unused Code introduced by
The property $send_email_from is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
68
69
    /**
70
     * Auto login users after registration
71
     *
72
     * @var    boolean
73
     * @config
74
     */
75
    private static $login_after_register = true;
0 ignored issues
show
Unused Code introduced by
The property $login_after_register is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
76
77
    /**
78
     * Add new users to the following groups. This is a list of group codes.
79
     * Adding a new code will add the user to this group
80
     *
81
     * @var    array
82
     * @config
83
     */
84
    private static $new_user_groups = array(
0 ignored issues
show
Unused Code introduced by
The property $new_user_groups is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
85
        "users-frontend"
86
    );
87
88
    /**
89
     * Remove a group from the list of groups a new user is added to on
90
     * registering.
91
     *
92
     * @param string $code Group code that will be used
93
     * 
94
     * @return void
95
     */
96
    public static function removeNewUserGroup($code)
97
    {
98
        if (isset(self::config()->new_user_groups[$code])) {
99
            unset(self::config()->new_user_groups[$code]);
100
        }
101
    }
102
103
    /**
104
     * Groups a user will be added to when verified. This should be an
105
     * array of group "codes", NOT names or ID's
106
     *
107
     * @var    array
108
     * @config
109
     */
110
    private static $verification_groups = array(
0 ignored issues
show
Unused Code introduced by
The property $verification_groups is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
111
        "users-verified"
112
    );
113
114
    /**
115
     * Remove a group from the list of groups a new user is added to on
116
     * registering.
117
     *
118
     * @param string $code Group code that will be used
119
     * 
120
     * @return void
121
     */
122
    public static function removeVerificationGroup($code)
123
    {
124
        if (isset(self::config()->verification_groups[$code])) {
125
            unset(self::config()->verification_groups[$code]);
126
        }
127
    }
128
}
129