Passed
Push — v1 ( 9d33f6...ef500b )
by Benjamin
02:28
created
providers/login/BaseProvider.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -95,8 +95,7 @@  discard block
 block discarded – undo
95 95
 		if ($providerConfig && isset($providerConfig['scope']))
96 96
 		{
97 97
 			return $providerConfig['scope'];
98
-		}
99
-		else
98
+		} else
100 99
 		{
101 100
 			return $this->getDefaultScope();
102 101
 		}
@@ -114,8 +113,7 @@  discard block
 block discarded – undo
114 113
 		if ($providerConfig && isset($providerConfig['authorizationOptions']))
115 114
 		{
116 115
 			return $providerConfig['authorizationOptions'];
117
-		}
118
-		else
116
+		} else
119 117
 		{
120 118
 			return $this->getDefaultAuthorizationOptions();
121 119
 		}
Please login to merge, or discard this patch.
models/Social_LoginAccountModel.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@
 block discarded – undo
26 26
 		if (craft()->config->get('useEmailAsUsername'))
27 27
 		{
28 28
 			return $this->email;
29
-		}
30
-		else
29
+		} else
31 30
 		{
32 31
 			return $this->username;
33 32
 		}
Please login to merge, or discard this patch.
elementtypes/Social_LoginAccountElementType.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -126,8 +126,7 @@  discard block
 block discarded – undo
126 126
 			$attributes = array(
127 127
 				'email' => Craft::t('Email'),
128 128
 			);
129
-		}
130
-		else
129
+		} else
131 130
 		{
132 131
 			$attributes = array(
133 132
 				'username' => Craft::t('Username'),
@@ -165,8 +164,7 @@  discard block
 block discarded – undo
165 164
 			$attributes = array(
166 165
 				'email' => array('label' => Craft::t('Email')),
167 166
 			);
168
-		}
169
-		else
167
+		} else
170 168
 		{
171 169
 			$attributes = array(
172 170
 				'username' => array('label' => Craft::t('Username')),
@@ -242,8 +240,7 @@  discard block
 block discarded – undo
242 240
 						'</div>';
243 241
 
244 242
 					return $html;
245
-				}
246
-				else
243
+				} else
247 244
 				{
248 245
 					return '';
249 246
 				}
Please login to merge, or discard this patch.
base/SocialTrait.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
             $url = UrlHelper::getUrl('social/install');
38 38
             craft()->request->redirect($url);
39 39
             return false;
40
-        }
41
-        else
40
+        } else
42 41
         {
43 42
             return true;
44 43
         }
@@ -96,8 +95,7 @@  discard block
 block discarded – undo
96 95
                 {
97 96
                     $dependencies[] = $dependency;
98 97
                 }
99
-            }
100
-            else
98
+            } else
101 99
             {
102 100
                 $dependencies[] = $dependency;
103 101
             }
Please login to merge, or discard this patch.
services/Social_LoginAccountsService.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -114,8 +114,7 @@  discard block
 block discarded – undo
114 114
             {
115 115
                 throw new Exception(Craft::t('No social user exists with the ID “{id}”', ['id' => $account->id]));
116 116
             }
117
-        }
118
-        else
117
+        } else
119 118
         {
120 119
             $accountRecord = new Social_LoginAccountRecord;
121 120
         }
@@ -153,8 +152,7 @@  discard block
 block discarded – undo
153 152
 
154 153
                     return true;
155 154
                 }
156
-            }
157
-            catch (\Exception $e)
155
+            } catch (\Exception $e)
158 156
             {
159 157
                 if ($transaction !== null)
160 158
                 {
@@ -165,8 +163,7 @@  discard block
 block discarded – undo
165 163
             }
166 164
 
167 165
             return true;
168
-        }
169
-        else
166
+        } else
170 167
         {
171 168
             return false;
172 169
         }
@@ -284,16 +281,14 @@  discard block
 block discarded – undo
284 281
             if (!$user)
285 282
             {
286 283
                 $user = $this->_registerUser($attributes, $providerHandle);
287
-            }
288
-            else
284
+            } else
289 285
             {
290 286
                 if (craft()->config->get('allowEmailMatch', 'social') !== true)
291 287
                 {
292 288
                     throw new Exception("An account already exists with this email: ".$attributes['email']);
293 289
                 }
294 290
             }
295
-        }
296
-        else
291
+        } else
297 292
         {
298 293
             throw new Exception("Email address not provided.");
299 294
         }
@@ -371,14 +366,12 @@  discard block
 block discarded – undo
371 366
                             try
372 367
                             {
373 368
                                 $newUser->{$attribute} = craft()->templates->renderString($template, $variables);
374
-                            }
375
-                            catch(\Exception $e)
369
+                            } catch(\Exception $e)
376 370
                             {
377 371
                                 SocialPlugin::log('Could not map:'.print_r([$attribute, $template, $variables, $e->getMessage()], true), LogLevel::Warning);
378 372
                             }
379 373
                         }
380
-                    }
381
-                    else
374
+                    } else
382 375
                     {
383 376
                         $fieldHandle = $key;
384 377
 
@@ -388,8 +381,7 @@  discard block
 block discarded – undo
388 381
                             try
389 382
                             {
390 383
                                 $userContent[$fieldHandle] = craft()->templates->renderString($template, $variables);
391
-                            }
392
-                            catch(\Exception $e)
384
+                            } catch(\Exception $e)
393 385
                             {
394 386
                                 SocialPlugin::log('Could not map:'.print_r([$template, $variables, $e->getMessage()], true), LogLevel::Warning);
395 387
                             }
@@ -433,13 +425,11 @@  discard block
 block discarded – undo
433 425
                     {
434 426
                         $photoUrl = craft()->templates->renderString($userMapping['photoUrl'], $variables);
435 427
                         $photoUrl = html_entity_decode($photoUrl);
436
-                    }
437
-                    catch(\Exception $e)
428
+                    } catch(\Exception $e)
438 429
                     {
439 430
                         SocialPlugin::log('Could not map:'.print_r(['photoUrl', $userMapping['photoUrl'], $variables, $e->getMessage()], true), LogLevel::Warning);
440 431
                     }
441
-                }
442
-                else
432
+                } else
443 433
                 {
444 434
                     if (!empty($attributes['photoUrl']))
445 435
                     {
Please login to merge, or discard this patch.
controllers/Social_LoginProvidersController.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,13 +63,11 @@  discard block
 block discarded – undo
63 63
 				}
64 64
 
65 65
 				$this->renderTemplate('social/loginproviders/_edit', $variables);
66
-			}
67
-			else
66
+			} else
68 67
 			{
69 68
 				throw new HttpException(404);
70 69
 			}
71
-		}
72
-		else
70
+		} else
73 71
 		{
74 72
 			throw new HttpException(404);
75 73
 		}
@@ -88,8 +86,7 @@  discard block
 block discarded – undo
88 86
 		if (craft()->social_loginProviders->enableLoginProvider($loginProvider))
89 87
 		{
90 88
 			craft()->userSession->setNotice(Craft::t('Login provider enabled.'));
91
-		}
92
-		else
89
+		} else
93 90
 		{
94 91
 			craft()->userSession->setError(Craft::t('Couldn’t enable login provider.'));
95 92
 		}
@@ -110,8 +107,7 @@  discard block
 block discarded – undo
110 107
 		if (craft()->social_loginProviders->disableLoginProvider($loginProvider))
111 108
 		{
112 109
 			craft()->userSession->setNotice(Craft::t('Login provider disabled.'));
113
-		}
114
-		else
110
+		} else
115 111
 		{
116 112
 			craft()->userSession->setError(Craft::t('Couldn’t disable login provider.'));
117 113
 		}
Please login to merge, or discard this patch.
controllers/Social_InstallController.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@
 block discarded – undo
26 26
             $this->renderTemplate('social/_special/install/dependencies', [
27 27
                 'pluginDependencies' => $missingDependencies
28 28
             ]);
29
-        }
30
-        else
29
+        } else
31 30
         {
32 31
             $this->redirect('social/settings');
33 32
         }
Please login to merge, or discard this patch.
controllers/SocialController.php 1 patch
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -91,14 +91,12 @@  discard block
 block discarded – undo
91 91
 				if($response['success'])
92 92
 				{
93 93
 					$this->_connectUserFromToken($response['token']);
94
-				}
95
-				else
94
+				} else
96 95
 				{
97 96
 					throw new \Exception($response['errorMsg']);
98 97
 				}
99 98
 			}
100
-		}
101
-		catch(\Guzzle\Http\Exception\BadResponseException $e)
99
+		} catch(\Guzzle\Http\Exception\BadResponseException $e)
102 100
 		{
103 101
 			$response = $e->getResponse();
104 102
 
@@ -110,8 +108,7 @@  discard block
 block discarded – undo
110 108
 			if($json)
111 109
 			{
112 110
 				$errorMsg = $json['error']['message'];
113
-			}
114
-			else
111
+			} else
115 112
 			{
116 113
 				$errorMsg = "Couldn’t login.";
117 114
 			}
@@ -119,8 +116,7 @@  discard block
 block discarded – undo
119 116
 			craft()->userSession->setFlash('error', $errorMsg);
120 117
 			$this->_cleanSession();
121 118
 			$this->redirect($this->referer);
122
-		}
123
-		catch (\Exception $e)
119
+		} catch (\Exception $e)
124 120
 		{
125 121
 			$errorMsg = $e->getMessage();
126 122
 			craft()->userSession->setFlash('error', $errorMsg);
@@ -213,8 +209,7 @@  discard block
 block discarded – undo
213 209
 		if ($craftUser)
214 210
 		{
215 211
 			$this->_linkAccountFromToken($token, $craftUser);
216
-		}
217
-		else
212
+		} else
218 213
 		{
219 214
 			$this->_registerOrLoginFromToken($token);
220 215
 		}
@@ -254,13 +249,11 @@  discard block
 block discarded – undo
254 249
 				craft()->userSession->setNotice(Craft::t('Social account linked.'));
255 250
 
256 251
 				$this->redirect($this->redirect);
257
-			}
258
-			else
252
+			} else
259 253
 			{
260 254
 				throw new Exception("This UID is already associated with another user. Disconnect from your current session and retry.");
261 255
 			}
262
-		}
263
-		else
256
+		} else
264 257
 		{
265 258
 			// save social user
266 259
 			$account = new Social_LoginAccountModel;
@@ -303,13 +296,11 @@  discard block
 block discarded – undo
303 296
 
304 297
 				// login
305 298
 				$this->_login($token);
306
-			}
307
-			else
299
+			} else
308 300
 			{
309 301
 				throw new Exception("Social account exists but Craft user doesn't");
310 302
 			}
311
-		}
312
-		else
303
+		} else
313 304
 		{
314 305
 			// register user
315 306
 			$craftUser = craft()->social_loginAccounts->registerUser($attributes, $socialLoginProvider->getHandle());
@@ -325,8 +316,7 @@  discard block
 block discarded – undo
325 316
 
326 317
 				// login
327 318
 				$this->_login($token, true);
328
-			}
329
-			else
319
+			} else
330 320
 			{
331 321
 				throw new Exception("Craft user couldn’t be created.");
332 322
 			}
@@ -352,15 +342,13 @@  discard block
 block discarded – undo
352 342
 			if ($registrationMode)
353 343
 			{
354 344
 				craft()->userSession->setNotice(Craft::t('Account created.'));
355
-			}
356
-			else
345
+			} else
357 346
 			{
358 347
 				craft()->userSession->setNotice(Craft::t('Logged in.'));
359 348
 			}
360 349
 
361 350
 			$this->redirect($this->redirect);
362
-		}
363
-		else
351
+		} else
364 352
 		{
365 353
 			$errorCode = craft()->social_userSession->getLoginErrorCode();
366 354
 			$errorMessage = craft()->social_userSession->getLoginErrorMessage($errorCode);
Please login to merge, or discard this patch.
controllers/Social_LoginAccountsController.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,13 +57,11 @@
 block discarded – undo
57 57
 				$variables['loginAccounts'] = $loginAccounts;
58 58
 
59 59
 				$this->renderTemplate('social/loginaccounts/_edit', $variables);
60
-			}
61
-			else
60
+			} else
62 61
 			{
63 62
 				throw new HttpException(404);
64 63
 			}
65
-		}
66
-		else
64
+		} else
67 65
 		{
68 66
 			throw new HttpException(404);
69 67
 		}
Please login to merge, or discard this patch.