Failed Conditions
Branch newinternal (bd75e4)
by Simon
03:48
created

CommunityUser::isCommunityUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Waca\DataObjects;
4
5
use DateTime;
6
use Waca\IdentificationVerifier;
7
8
/**
9
 * User data object
10
 */
11
class CommunityUser extends User
12
{
13
	public function getId()
14
	{
15
		return -1;
16
	}
17
18
	public function save()
19
	{
20
		// Do nothing
21
	}
22
23
	public function authenticate($password)
24
	{
25
		// Impossible to log in as this user
26
		return false;
27
	}
28
29
	#region properties
30
31
	/**
32
	 * @return string
33
	 */
34
	public function getUsername()
35
	{
36
		global $communityUsername;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
37
38
		return $communityUsername;
39
	}
40
41
	public function setUsername($username)
42
	{
43
	}
44
45
	/**
46
	 * @return string
47
	 */
48
	public function getEmail()
49
	{
50
		global $cDataClearEmail;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
51
52
		return $cDataClearEmail;
53
	}
54
55
	public function setEmail($email)
56
	{
57
	}
58
59
	public function setPassword($password)
60
	{
61
	}
62
63
	public function getStatus()
64
	{
65
		return "Community";
66
	}
67
68
	public function getOnWikiName()
69
	{
70
		return "127.0.0.1";
71
	}
72
73
	public function getStoredOnWikiName()
74
	{
75
		return $this->getOnWikiName();
76
	}
77
78
	public function setOnWikiName($onWikiName)
79
	{
80
	}
81
82
	public function getWelcomeSig()
83
	{
84
		return null;
85
	}
86
87
	public function setWelcomeSig($welcomeSig)
88
	{
89
	}
90
91
	public function getLastActive()
92
	{
93
		$now = new DateTime();
94
95
		return $now->format("Y-m-d H:i:s");
96
	}
97
98
	public function getForceLogout()
99
	{
100
		return true;
101
	}
102
103
	public function setForceLogout($forceLogout)
104
	{
105
	}
106
107
	/**
108
	 * @param string $status
109
	 */
110
	public function setStatus($status)
111
	{
112
	}
113
114
	public function getWelcomeTemplate()
115
	{
116
		return 0;
117
	}
118
119
	public function setWelcomeTemplate($welcomeTemplate)
120
	{
121
	}
122
123
	public function getAbortPref()
124
	{
125
		return 0;
126
	}
127
128
	public function setAbortPref($abortPreference)
129
	{
130
	}
131
132
	public function getConfirmationDiff()
133
	{
134
		return null;
135
	}
136
137
	public function setConfirmationDiff($confirmationDiff)
138
	{
139
	}
140
141
	public function getEmailSig()
142
	{
143
		return null;
144
	}
145
146
	public function setEmailSig($emailSignature)
147
	{
148
	}
149
150
	#endregion
151
152
	#region user access checks
153
154
	public function isAdmin()
155
	{
156
		return false;
157
	}
158
159
	public function isCheckuser()
160
	{
161
		return false;
162
	}
163
164
	public function isIdentified(IdentificationVerifier $iv)
165
	{
166
		return false;
167
	}
168
169
	public function isSuspended()
170
	{
171
		return false;
172
	}
173
174
	public function isNewUser()
175
	{
176
		return false;
177
	}
178
179
	public function isUser()
180
	{
181
		return false;
182
	}
183
184
	public function isDeclined()
185
	{
186
		return false;
187
	}
188
189
	public function isCommunityUser()
190
	{
191
		return true;
192
	}
193
194
	#endregion 
195
196
	#region OAuth
197
198
	public function getOAuthIdentity($useCached = false)
199
	{
200
		return null;
201
	}
202
203
	public function isOAuthLinked()
204
	{
205
		return false;
206
	}
207
208
	public function oauthCanUse()
209
	{
210
		return false;
211
	}
212
213
	public function oauthCanEdit()
214
	{
215
		return false;
216
	}
217
218
	public function oauthCanCreateAccount()
219
	{
220
		return false;
221
	}
222
223
	protected function oauthCanCheckUser()
224
	{
225
		return false;
226
	}
227
228
	#endregion
229
230
	public function getApprovalDate()
231
	{
232
		$data = DateTime::createFromFormat("Y-m-d H:i:s", "1970-01-01 00:00:00");
233
234
		return $data;
235
	}
236
}
237