Completed
Push — rbac ( 1ec5d5...5c33ef )
by Simon
04:39
created

CommunityUser   B

Complexity

Total Complexity 38

Size/Duplication

Total Lines 211
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 2.5%

Importance

Changes 0
Metric Value
dl 0
loc 211
ccs 2
cts 80
cp 0.025
rs 8.3999
c 0
b 0
f 0
wmc 38
lcom 0
cbo 1

38 Methods

Rating   Name   Duplication   Size   Complexity  
A isCommunityUser() 0 4 1
A getId() 0 4 1
A save() 0 4 1
A authenticate() 0 5 1
A getUsername() 0 6 1
A setUsername() 0 3 1
A getEmail() 0 6 1
A setEmail() 0 3 1
A setPassword() 0 3 1
A getStatus() 0 4 1
A getOnWikiName() 0 4 1
A getStoredOnWikiName() 0 4 1
A setOnWikiName() 0 3 1
A getWelcomeSig() 0 4 1
A setWelcomeSig() 0 3 1
A getLastActive() 0 6 1
A getForceLogout() 0 4 1
A setForceLogout() 0 3 1
A setStatus() 0 3 1
A getWelcomeTemplate() 0 4 1
A setWelcomeTemplate() 0 3 1
A getAbortPref() 0 4 1
A setAbortPref() 0 3 1
A getConfirmationDiff() 0 4 1
A setConfirmationDiff() 0 3 1
A getEmailSig() 0 4 1
A setEmailSig() 0 3 1
A isIdentified() 0 4 1
A isSuspended() 0 4 1
A isNewUser() 0 4 1
A isDeclined() 0 4 1
A getOAuthIdentity() 0 4 1
A isOAuthLinked() 0 4 1
A oauthCanUse() 0 4 1
A oauthCanEdit() 0 4 1
A oauthCanCreateAccount() 0 4 1
A oauthCanCheckUser() 0 4 1
A getApprovalDate() 0 6 1
1
<?php
2
/******************************************************************************
3
 * Wikipedia Account Creation Assistance tool                                 *
4
 *                                                                            *
5
 * All code in this file is released into the public domain by the ACC        *
6
 * Development Team. Please see team.json for a list of contributors.         *
7
 ******************************************************************************/
8
9
namespace Waca\DataObjects;
10
11
use DateTime;
12
use Waca\IdentificationVerifier;
13
14
/**
15
 * User data object
16
 */
17
class CommunityUser extends User
18
{
19
    public function getId()
20
    {
21
        return -1;
22
    }
23
24
    public function save()
25
    {
26
        // Do nothing
27
    }
28
29
    public function authenticate($password)
30
    {
31
        // Impossible to log in as this user
32
        return false;
33
    }
34
35
    #region properties
36
37
    /**
38
     * @return string
39
     */
40
    public function getUsername()
41
    {
42
        global $communityUsername;
43
44
        return $communityUsername;
45
    }
46
47
    public function setUsername($username)
48
    {
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getEmail()
55
    {
56
        global $cDataClearEmail;
57
58
        return $cDataClearEmail;
59
    }
60
61
    public function setEmail($email)
62
    {
63
    }
64
65
    public function setPassword($password)
66
    {
67
    }
68
69
    public function getStatus()
70
    {
71
        return "Community";
72
    }
73
74
    public function getOnWikiName()
75
    {
76
        return "127.0.0.1";
77
    }
78
79
    public function getStoredOnWikiName()
80
    {
81
        return $this->getOnWikiName();
82
    }
83
84
    public function setOnWikiName($onWikiName)
85
    {
86
    }
87
88
    public function getWelcomeSig()
89
    {
90
        return null;
91
    }
92
93
    public function setWelcomeSig($welcomeSig)
94
    {
95
    }
96
97
    public function getLastActive()
98
    {
99
        $now = new DateTime();
100
101
        return $now->format("Y-m-d H:i:s");
102
    }
103
104
    public function getForceLogout()
105
    {
106
        return true;
107
    }
108
109
    public function setForceLogout($forceLogout)
110
    {
111
    }
112
113
    /**
114
     * @param string $status
115
     */
116
    public function setStatus($status)
117
    {
118
    }
119
120
    public function getWelcomeTemplate()
121
    {
122
        return 0;
123
    }
124
125
    public function setWelcomeTemplate($welcomeTemplate)
126
    {
127
    }
128
129
    public function getAbortPref()
130
    {
131
        return 0;
132
    }
133
134
    public function setAbortPref($abortPreference)
135
    {
136
    }
137
138
    public function getConfirmationDiff()
139
    {
140
        return null;
141
    }
142
143
    public function setConfirmationDiff($confirmationDiff)
144
    {
145
    }
146
147
    public function getEmailSig()
148
    {
149
        return null;
150
    }
151
152
    public function setEmailSig($emailSignature)
153
    {
154
    }
155
156
    #endregion
157
158
    #region user access checks
159
160
    public function isIdentified(IdentificationVerifier $iv)
161
    {
162
        return false;
163
    }
164
165
    public function isSuspended()
166
    {
167
        return false;
168
    }
169
170
    public function isNewUser()
171
    {
172
        return false;
173
    }
174
175
    public function isDeclined()
176
    {
177
        return false;
178
    }
179
180 2
    public function isCommunityUser()
181
    {
182 2
        return true;
183
    }
184
185
    #endregion 
186
187
    #region OAuth
188
189
    public function getOAuthIdentity($useCached = false)
190
    {
191
        return null;
192
    }
193
194
    public function isOAuthLinked()
195
    {
196
        return false;
197
    }
198
199
    public function oauthCanUse()
200
    {
201
        return false;
202
    }
203
204
    public function oauthCanEdit()
205
    {
206
        return false;
207
    }
208
209
    public function oauthCanCreateAccount()
210
    {
211
        return false;
212
    }
213
214
    protected function oauthCanCheckUser()
215
    {
216
        return false;
217
    }
218
219
    #endregion
220
221
    public function getApprovalDate()
222
    {
223
        $data = DateTime::createFromFormat("Y-m-d H:i:s", "1970-01-01 00:00:00");
224
225
        return $data;
226
    }
227
}
228