@@ -233,6 +233,9 @@ |
||
233 | 233 | Logger::backgroundJobComplete($this->getDatabase(), $this->getJob()); |
234 | 234 | } |
235 | 235 | |
236 | + /** |
|
237 | + * @param string $reason |
|
238 | + */ |
|
236 | 239 | protected function markCancelled($reason = null) |
237 | 240 | { |
238 | 241 | $this->job->setStatus(JobQueue::STATUS_CANCELLED); |
@@ -177,7 +177,7 @@ |
||
177 | 177 | throw new ApplicationLogicException('Cannot locate request'); |
178 | 178 | } |
179 | 179 | |
180 | - if($this->job->getEmailTemplate() !== null){ |
|
180 | + if($this->job->getEmailTemplate() !== null) { |
|
181 | 181 | $this->emailTemplate = EmailTemplate::getById($this->job->getEmailTemplate(), $this->getDatabase()); |
182 | 182 | |
183 | 183 | if ($this->emailTemplate === false) { |
@@ -105,6 +105,9 @@ discard block |
||
105 | 105 | return $this->getMediaWikiHelper()->checkAccountExists($name); |
106 | 106 | } |
107 | 107 | |
108 | + /** |
|
109 | + * @param string $reason |
|
110 | + */ |
|
108 | 111 | protected function markFailed($reason = null) |
109 | 112 | { |
110 | 113 | $this->request->setStatus(RequestStatus::HOSPITAL); |
@@ -116,7 +119,7 @@ discard block |
||
116 | 119 | } |
117 | 120 | |
118 | 121 | /** |
119 | - * @param $user |
|
122 | + * @param User $user |
|
120 | 123 | * |
121 | 124 | * @throws ApplicationLogicException |
122 | 125 | */ |
@@ -82,7 +82,8 @@ |
||
82 | 82 | */ |
83 | 83 | protected abstract function getMediaWikiClient(); |
84 | 84 | |
85 | - protected function getMediaWikiHelper(){ |
|
85 | + protected function getMediaWikiHelper() |
|
86 | + { |
|
86 | 87 | if($this->mwHelper === null) { |
87 | 88 | $this->mwHelper = new MediaWikiHelper($this->getMediaWikiClient(), $this->getSiteConfiguration()); |
88 | 89 | } |
@@ -225,7 +225,7 @@ |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
228 | - * @return mixed |
|
228 | + * @return string |
|
229 | 229 | */ |
230 | 230 | public function getError() |
231 | 231 | { |
@@ -58,7 +58,8 @@ |
||
58 | 58 | /** |
59 | 59 | * This feels like the least bad place to put this method. |
60 | 60 | */ |
61 | - public static function getTaskDescriptions() { |
|
61 | + public static function getTaskDescriptions() |
|
62 | + { |
|
62 | 63 | return array( |
63 | 64 | BotCreationTask::class => 'Create account (via bot)', |
64 | 65 | UserCreationTask::class => 'Create account (via OAuth)', |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | #region properties |
84 | 84 | |
85 | 85 | /** |
86 | - * @return mixed |
|
86 | + * @return integer |
|
87 | 87 | */ |
88 | 88 | public function getUserId() |
89 | 89 | { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | - * @return mixed |
|
102 | + * @return string |
|
103 | 103 | */ |
104 | 104 | public function getToken() |
105 | 105 | { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * @return mixed |
|
118 | + * @return string |
|
119 | 119 | */ |
120 | 120 | public function getSecret() |
121 | 121 | { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
134 | - * @return mixed |
|
134 | + * @return string |
|
135 | 135 | */ |
136 | 136 | public function getType() |
137 | 137 | { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
142 | - * @param mixed $type |
|
142 | + * @param string $type |
|
143 | 143 | */ |
144 | 144 | public function setType($type) |
145 | 145 | { |
@@ -83,7 +83,7 @@ |
||
83 | 83 | |
84 | 84 | /** |
85 | 85 | * @param $apiParams |
86 | - * @param $method |
|
86 | + * @param string $method |
|
87 | 87 | * |
88 | 88 | * @return mixed |
89 | 89 | * @throws ApplicationLogicException |
@@ -142,7 +142,7 @@ |
||
142 | 142 | |
143 | 143 | $loginResponse = $this->callApi($params, 'POST'); |
144 | 144 | |
145 | - if($loginResponse->login->result == 'Success'){ |
|
145 | + if($loginResponse->login->result == 'Success') { |
|
146 | 146 | return; |
147 | 147 | } |
148 | 148 |
@@ -10,5 +10,8 @@ |
||
10 | 10 | |
11 | 11 | interface IMediaWikiClient |
12 | 12 | { |
13 | + /** |
|
14 | + * @param string $method |
|
15 | + */ |
|
13 | 16 | function doApiCall($params, $method); |
14 | 17 | } |
15 | 18 | \ No newline at end of file |
@@ -63,6 +63,10 @@ discard block |
||
63 | 63 | private $siteConfiguration; |
64 | 64 | |
65 | 65 | #region Static methods |
66 | + |
|
67 | + /** |
|
68 | + * @param null|string $requestToken |
|
69 | + */ |
|
66 | 70 | public static function findUserByRequestToken($requestToken, PdoDatabase $database) |
67 | 71 | { |
68 | 72 | $statement = $database->prepare(<<<'SQL' |
@@ -119,6 +123,11 @@ discard block |
||
119 | 123 | } |
120 | 124 | } |
121 | 125 | |
126 | + /** |
|
127 | + * @param integer $userId |
|
128 | + * @param null|PdoDatabase $database |
|
129 | + * @param string $tokenType |
|
130 | + */ |
|
122 | 131 | private static function runTokenCount($userId, $database, $tokenType) |
123 | 132 | { |
124 | 133 | if (self::$tokenCountStatement === null) { |
@@ -182,7 +191,7 @@ discard block |
||
182 | 191 | /** |
183 | 192 | * Attempts to figure out if a user is partially linked to OAuth, and therefore needs to complete the OAuth |
184 | 193 | * procedure before configuring. |
185 | - * @return bool |
|
194 | + * @return boolean|null |
|
186 | 195 | */ |
187 | 196 | public function isPartiallyLinked() |
188 | 197 | { |
@@ -245,6 +254,9 @@ discard block |
||
245 | 254 | return $this->oauthProtocolHelper->getAuthoriseUrl($token->key); |
246 | 255 | } |
247 | 256 | |
257 | + /** |
|
258 | + * @param null|string $verificationToken |
|
259 | + */ |
|
248 | 260 | public function completeHandshake($verificationToken) |
249 | 261 | { |
250 | 262 | $this->getTokenStatement->execute(array(':user' => $this->user->getId(), ':type' => self::TOKEN_REQUEST)); |
@@ -241,7 +241,8 @@ |
||
241 | 241 | * @param string $username |
242 | 242 | * @return bool |
243 | 243 | */ |
244 | - public function checkAccountExists($username) { |
|
244 | + public function checkAccountExists($username) |
|
245 | + { |
|
245 | 246 | $parameters = array( |
246 | 247 | 'action' => 'query', |
247 | 248 | 'list' => 'users', |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return JobQueueSearchHelper |
25 | 25 | */ |
26 | - public static function get(PdoDatabase $database) { |
|
26 | + public static function get(PdoDatabase $database) |
|
27 | + { |
|
27 | 28 | $helper = new JobQueueSearchHelper($database); |
28 | 29 | return $helper; |
29 | 30 | } |
@@ -33,7 +34,8 @@ discard block |
||
33 | 34 | * |
34 | 35 | * @return $this |
35 | 36 | */ |
36 | - public function statusIn($statuses) { |
|
37 | + public function statusIn($statuses) |
|
38 | + { |
|
37 | 39 | $this->inClause('status', $statuses); |
38 | 40 | |
39 | 41 | return $this; |
@@ -42,27 +44,31 @@ discard block |
||
42 | 44 | /** |
43 | 45 | * @return $this |
44 | 46 | */ |
45 | - public function notAcknowledged() { |
|
47 | + public function notAcknowledged() |
|
48 | + { |
|
46 | 49 | $this->whereClause .= ' AND (acknowledged IS NULL OR acknowledged = 0)'; |
47 | 50 | |
48 | 51 | return $this; |
49 | 52 | } |
50 | 53 | |
51 | - public function byTask($task) { |
|
54 | + public function byTask($task) |
|
55 | + { |
|
52 | 56 | $this->whereClause .= ' AND task = ?'; |
53 | 57 | $this->parameterList[] = $task; |
54 | 58 | |
55 | 59 | return $this; |
56 | 60 | } |
57 | 61 | |
58 | - public function byUser($userId) { |
|
62 | + public function byUser($userId) |
|
63 | + { |
|
59 | 64 | $this->whereClause .= ' AND user = ?'; |
60 | 65 | $this->parameterList[] = $userId; |
61 | 66 | |
62 | 67 | return $this; |
63 | 68 | } |
64 | 69 | |
65 | - public function byStatus($status) { |
|
70 | + public function byStatus($status) |
|
71 | + { |
|
66 | 72 | $this->whereClause .= ' AND status = ?'; |
67 | 73 | $this->parameterList[] = $status; |
68 | 74 |