Failed Conditions
Push — rbac ( be68b4...52c28b )
by Michael
03:11
created

CommunityUser::getWelcomeTemplate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
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
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getId()
Loading history...
23
24
    public function save()
25
    {
26
        // Do nothing
27
    }
0 ignored issues
show
Coding Style introduced by
Expected //end save()
Loading history...
28
29
    public function authenticate($password)
30
    {
31
        // Impossible to log in as this user
32
        return false;
33
    }
0 ignored issues
show
Coding Style introduced by
Expected //end authenticate()
Loading history...
34
35
    #region properties
36
37
    /**
38
     * @return string
39
     */
40
    public function getUsername()
41
    {
42
        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...
43
44
        return $communityUsername;
45
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getUsername()
Loading history...
46
47
    public function setUsername($username)
48
    {
49
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setUsername()
Loading history...
50
51
    /**
52
     * @return string
53
     */
54
    public function getEmail()
55
    {
56
        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...
57
58
        return $cDataClearEmail;
59
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getEmail()
Loading history...
60
61
    public function setEmail($email)
62
    {
63
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setEmail()
Loading history...
64
65
    public function setPassword($password)
66
    {
67
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setPassword()
Loading history...
68
69
    public function getStatus()
70
    {
71
        return "Community";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Community does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
72
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getStatus()
Loading history...
73
74
    public function getOnWikiName()
75
    {
76
        return "127.0.0.1";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 127.0.0.1 does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
77
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getOnWikiName()
Loading history...
78
79
    public function getStoredOnWikiName()
80
    {
81
        return $this->getOnWikiName();
82
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getStoredOnWikiName()
Loading history...
83
84
    public function setOnWikiName($onWikiName)
85
    {
86
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setOnWikiName()
Loading history...
87
88
    public function getWelcomeSig()
89
    {
90
        return null;
91
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getWelcomeSig()
Loading history...
92
93
    public function setWelcomeSig($welcomeSig)
94
    {
95
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setWelcomeSig()
Loading history...
96
97
    public function getLastActive()
98
    {
99
        $now = new DateTime();
100
101
        return $now->format("Y-m-d H:i:s");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Y-m-d H:i:s does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
102
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getLastActive()
Loading history...
103
104
    public function getForceLogout()
105
    {
106
        return true;
107
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getForceLogout()
Loading history...
108
109
    public function setForceLogout($forceLogout)
110
    {
111
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setForceLogout()
Loading history...
112
113
    /**
114
     * @param string $status
115
     */
116
    public function setStatus($status)
117
    {
118
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setStatus()
Loading history...
119
120
    public function getWelcomeTemplate()
121
    {
122
        return 0;
123
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getWelcomeTemplate()
Loading history...
124
125
    public function setWelcomeTemplate($welcomeTemplate)
126
    {
127
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setWelcomeTemplate()
Loading history...
128
129
    public function getAbortPref()
130
    {
131
        return 0;
132
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getAbortPref()
Loading history...
133
134
    public function setAbortPref($abortPreference)
135
    {
136
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setAbortPref()
Loading history...
137
138
    public function getConfirmationDiff()
139
    {
140
        return null;
141
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getConfirmationDiff()
Loading history...
142
143
    public function setConfirmationDiff($confirmationDiff)
144
    {
145
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setConfirmationDiff()
Loading history...
146
147
    public function getEmailSig()
148
    {
149
        return null;
150
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getEmailSig()
Loading history...
151
152
    public function setEmailSig($emailSignature)
153
    {
154
    }
0 ignored issues
show
Coding Style introduced by
Expected //end setEmailSig()
Loading history...
155
156
    #endregion
157
158
    #region user access checks
159
160
    public function isIdentified(IdentificationVerifier $iv)
161
    {
162
        return false;
163
    }
0 ignored issues
show
Coding Style introduced by
Expected //end isIdentified()
Loading history...
164
165
    public function isSuspended()
166
    {
167
        return false;
168
    }
0 ignored issues
show
Coding Style introduced by
Expected //end isSuspended()
Loading history...
169
170
    public function isNewUser()
171
    {
172
        return false;
173
    }
0 ignored issues
show
Coding Style introduced by
Expected //end isNewUser()
Loading history...
174
175
    public function isDeclined()
176
    {
177
        return false;
178
    }
0 ignored issues
show
Coding Style introduced by
Expected //end isDeclined()
Loading history...
179
180
    public function isCommunityUser()
181
    {
182
        return true;
183
    }
0 ignored issues
show
Coding Style introduced by
Expected //end isCommunityUser()
Loading history...
184
185
    #endregion 
186
187
    #region OAuth
188
189
    public function getOAuthIdentity($useCached = false)
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$useCached" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$useCached"; expected 0 but found 1
Loading history...
190
    {
191
        return null;
192
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getOAuthIdentity()
Loading history...
193
194
    public function isOAuthLinked()
195
    {
196
        return false;
197
    }
0 ignored issues
show
Coding Style introduced by
Expected //end isOAuthLinked()
Loading history...
198
199
    public function oauthCanUse()
200
    {
201
        return false;
202
    }
0 ignored issues
show
Coding Style introduced by
Expected //end oauthCanUse()
Loading history...
203
204
    public function oauthCanEdit()
205
    {
206
        return false;
207
    }
0 ignored issues
show
Coding Style introduced by
Expected //end oauthCanEdit()
Loading history...
208
209
    public function oauthCanCreateAccount()
210
    {
211
        return false;
212
    }
0 ignored issues
show
Coding Style introduced by
Expected //end oauthCanCreateAccount()
Loading history...
213
214
    protected function oauthCanCheckUser()
215
    {
216
        return false;
217
    }
0 ignored issues
show
Coding Style introduced by
Expected //end oauthCanCheckUser()
Loading history...
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");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Y-m-d H:i:s does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal 1970-01-01 00:00:00 does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
224
225
        return $data;
226
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getApprovalDate()
Loading history...
227
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
228