Passed
Push — master ( 193348...182172 )
by Matthew
04:45
created
api/Controllers/Commish/UserProfileController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
   public function Get(Application $app, Request $request) {
13 13
     $user = $app['phpdraft.LoginUserService']->GetCurrentUser();
14 14
 
15
-    if(empty($user)) {
15
+    if (empty($user)) {
16 16
       return $app->json(new PhpDraftResponse(false));
17 17
     }
18 18
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
   public function Put(Application $app, Request $request) {
23 23
     $validity = $app['phpdraft.LoginUserValidator']->IsUserProfileUpdateValid($request);
24 24
 
25
-    if(!$validity->success) {
25
+    if (!$validity->success) {
26 26
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
27 27
     }
28 28
 
Please login to merge, or discard this patch.
api/Controllers/Commish/TradeController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
     try {
21 21
       $manager = $app['phpdraft.ManagerRepository']->Load($managerId);
22
-    } catch(\Exception $e) {
22
+    } catch (\Exception $e) {
23 23
       $response = new PhpDraftResponse(false, array());
24 24
       $response->errors[] = "Unable to load manager #$managerId";
25 25
       return $app->json($response, Response::HTTP_BAD_REQUEST);
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     $validity = $app['phpdraft.TradeValidator']->IsManagerValidForAssetRetrieval($draft, $manager);
29 29
 
30
-    if(!$validity->success) {
30
+    if (!$validity->success) {
31 31
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
32 32
     }
33 33
 
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
       $newTrade->manager1 = $app['phpdraft.ManagerRepository']->Load($newTrade->manager1_id);
54 54
       $newTrade->manager2 = $app['phpdraft.ManagerRepository']->Load($newTrade->manager2_id);
55 55
 
56
-      foreach($assets_json as $asset_id) {
56
+      foreach ($assets_json as $asset_id) {
57 57
         $newTradeAsset = new TradeAsset();
58 58
         $newTradeAsset->player = $app['phpdraft.PickRepository']->Load($asset_id);
59 59
         $newTradeAsset->was_drafted = $app['phpdraft.PickService']->PickHasBeenSelected($newTradeAsset->player);
60 60
 
61
-        if($newTradeAsset->player->manager_id == $newTrade->manager1_id) {
61
+        if ($newTradeAsset->player->manager_id == $newTrade->manager1_id) {
62 62
           $newTradeAsset->oldmanager_id = $newTrade->manager1_id;
63 63
           $newTradeAsset->newmanager_id = $newTrade->manager2_id;
64 64
           $newTradeAsset->oldmanager = $newTrade->manager1;
65 65
           $newTradeAsset->newmanager = $newTrade->manager2;
66
-        } else if($newTradeAsset->player->manager_id == $newTrade->manager2_id) {
66
+        } else if ($newTradeAsset->player->manager_id == $newTrade->manager2_id) {
67 67
           $newTradeAsset->oldmanager_id = $newTrade->manager2_id;
68 68
           $newTradeAsset->newmanager_id = $newTrade->manager1_id;
69 69
           $newTradeAsset->oldmanager = $newTrade->manager2;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
         $newTrade->trade_assets[] = $newTradeAsset;
76 76
       }
77
-    } catch(\Exception $e) {
77
+    } catch (\Exception $e) {
78 78
       $response = new PhpDraftResponse(false, array());
79 79
       $message = $e->getMessage();
80 80
       $response->errors[] = "Unable to build trade: $message";
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
     $validity = $app['phpdraft.TradeValidator']->IsTradeValid($draft, $newTrade);
86 86
 
87
-    if(!$validity->success) {
87
+    if (!$validity->success) {
88 88
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
89 89
     }
90 90
 
Please login to merge, or discard this patch.
api/Controllers/IndexController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
     $minified_css = '';
14 14
 
15
-    foreach($colors as $position => $hex_color_key) {
15
+    foreach ($colors as $position => $hex_color_key) {
16 16
       $minified_css .= "div.pick$position{background-color:$hex_color_key;}";
17 17
     }
18 18
 
Please login to merge, or discard this patch.
api/Controllers/Admin/ProPlayerController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 
23 23
     $validity = $app['phpdraft.ProPlayerValidator']->IsUploadSportValid($sport, $file);
24 24
 
25
-    if(!$validity->success) {
25
+    if (!$validity->success) {
26 26
       return $app->json($validity, $validity->responseType());
27 27
     }
28 28
 
Please login to merge, or discard this patch.
api/Controllers/Admin/UserController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     $validity = $app['phpdraft.LoginUserValidator']->IsAdminUserUpdateValid($user);
32 32
 
33
-    if(!$validity->success) {
33
+    if (!$validity->success) {
34 34
       return $app->json($validity, $validity->responseType());
35 35
     }
36 36
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     $user_id = $request->get('user_id');
46 46
     $user = $app['phpdraft.LoginUserRepository']->LoadById($user_id);
47 47
 
48
-    if($app['phpdraft.LoginUserService']->CurrentUserIsAdmin($user)) {
48
+    if ($app['phpdraft.LoginUserService']->CurrentUserIsAdmin($user)) {
49 49
       $response = new PhpDraftResponse(false, array());
50 50
       $response->errors[] = "Unable to delete user - user is admin.";
51 51
 
Please login to merge, or discard this patch.
api/Controllers/DraftController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
     $draft_id = (int)$request->get('id');
12 12
     $getDraftData = $request->get('get_draft_data') == 'true';
13 13
 
14
-    if(empty($draft_id) || $draft_id == 0) {
14
+    if (empty($draft_id) || $draft_id == 0) {
15 15
       throw new \Exception("Unable to load draft.");
16 16
     }
17 17
 
Please login to merge, or discard this patch.
api/Controllers/PickController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     $draftId = (int)$request->get('draft_id');
31 31
     $amount = (int)$request->get('amount');
32 32
 
33
-    if($amount == 0) {
33
+    if ($amount == 0) {
34 34
       $amount = 10;
35 35
     }
36 36
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     $draftId = (int)$request->get('draft_id');
42 42
     $amount = (int)$request->get('amount');
43 43
 
44
-    if($amount == 0) {
44
+    if ($amount == 0) {
45 45
       $amount = 10;
46 46
     }
47 47
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
   public function GetAllManagerPicks(Application $app, Request $request) {
54 54
     $draftId = (int)$request->get('draft_id');
55
-    $managerId  = (int)$request->get('manager_id');
55
+    $managerId = (int)$request->get('manager_id');
56 56
 
57 57
     $draft = $app['phpdraft.DraftRepository']->Load($draftId);
58 58
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     #If there's a space and no matches so far, create another searches where we manually split them firstname/lastname by sace automatically
104 104
     $splitNameAutomatically = count($pickSearchModel->player_results) == 0 && strpos($keywords, " ") != false;
105 105
 
106
-    if($splitNameAutomatically) {
106
+    if ($splitNameAutomatically) {
107 107
       $pickSearchModel = new PickSearchModel($draftId, $keywords, $team, $position, $sort);
108 108
       $names = explode(" ", $keywords, 2);
109 109
       $pickSearchModel = $app['phpdraft.PickRepository']->SearchSplit($pickSearchModel, $names[0], $names[1]);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
       $pick = $app['phpdraft.PickRepository']->Load($pick_id);
122 122
 
123 123
       $pick->depth_chart_position_id = (int)$request->get('position_id');
124
-    } catch(\Exception $e) {
124
+    } catch (\Exception $e) {
125 125
       $response = new PhpDraftResponse(false, array());
126 126
       $response->errors[] = "Unable to edit pick #$pick_id";
127 127
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
     $validity = $app['phpdraft.PickValidator']->IsPickValidForDepthChartUpdate($draft, $pick);
132 132
 
133
-    if(!$validity->success) {
133
+    if (!$validity->success) {
134 134
       return $app->json($validity, $validity->responseType());
135 135
     }
136 136
 
Please login to merge, or discard this patch.
api/Controllers/ManagerController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@
 block discarded – undo
17 17
     $draft_id = (int)$request->get('draft_id');
18 18
     $manager_id = (int)$request->get('manager_id');
19 19
 
20
-    if(empty($draft_id) || $draft_id == 0) {
20
+    if (empty($draft_id) || $draft_id == 0) {
21 21
       throw new \Exception("Unable to load draft.");
22 22
     }
23 23
 
24 24
     $draft = $app['phpdraft.DraftRepository']->Load($draft_id);
25 25
 
26
-    if(!$draft->using_depth_charts) {
26
+    if (!$draft->using_depth_charts) {
27 27
       $response = $app['phpdraft.ResponseFactory'](false, array("Draft is not configured to use depth charts."));
28 28
       return $app->json($response, $response->responseType());
29 29
     }
Please login to merge, or discard this patch.
api/Controllers/AuthenticationController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     try {
23 23
       $credentialValidity = $app['phpdraft.LoginUserValidator']->areLoginCredentialsValid($email, $password);
24 24
 
25
-      if($credentialValidity->success == false) {
25
+      if ($credentialValidity->success == false) {
26 26
         throw new UsernameNotFoundException(sprintf('Email %s does not exist', $email));
27 27
       }
28 28
 
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
         $response->auth_timeout = $authTimeout->format('Y-m-d H:i:s');
43 43
 
44 44
         //If user is enabled, provided valid password and has a verification (pwd reset) key, wipe it (no longer needed)
45
-        if($user->hasVerificationKey()) {
45
+        if ($user->hasVerificationKey()) {
46 46
           $app['phpdraft.LoginUserRepository']->EraseVerificationKey($user->getEmail());
47 47
         }
48 48
       }
49 49
     } catch (UsernameNotFoundException $e) {
50 50
       $response->success = false;
51
-      $response->errors[] =  'Invalid credentials.';
51
+      $response->errors[] = 'Invalid credentials.';
52 52
     }
53 53
 
54 54
     return $app->json($response, $response->responseType());
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
   public function Register(Application $app, Request $request) {
58 58
     $validity = $app['phpdraft.LoginUserValidator']->IsRegistrationUserValid($request);
59 59
 
60
-    if(!$validity->success) {
60
+    if (!$validity->success) {
61 61
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
62 62
     }
63 63
 
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
     $captcha = $request->get('_recaptcha');
71 71
     $userIp = $request->getClientIp();
72 72
 
73
-    if(!in_array($userIp, $whitelist)){
73
+    if (!in_array($userIp, $whitelist)) {
74 74
 
75 75
       $recaptcha = new \ReCaptcha\ReCaptcha(RECAPTCHA_SECRET);
76 76
       $recaptchaResponse = $recaptcha->verify($captcha, $userIp);
77 77
 
78
-      if(!$recaptchaResponse->isSuccess()) {
78
+      if (!$recaptchaResponse->isSuccess()) {
79 79
         $response = new PhpDraftResponse(false, array());
80 80
         $response->errors = $recaptchaResponse->getErrorCodes();
81 81
         return $app->json($response, $response->responseType());
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
   public function VerifyAccount(Application $app, Request $request) {
97 97
     $validity = $app['phpdraft.LoginUserValidator']->IsVerificationValid($request);
98 98
 
99
-    if(!$validity->success) {
99
+    if (!$validity->success) {
100 100
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
101 101
     }
102 102
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
   public function LostPassword(Application $app, Request $request) {
113 113
     $validity = $app['phpdraft.LoginUserValidator']->IsForgottenPasswordUserValid($request);
114 114
 
115
-    if(!$validity->success) {
115
+    if (!$validity->success) {
116 116
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
117 117
     }
118 118
 
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
     $captcha = $request->get('_recaptcha');
128 128
     $userIp = $request->getClientIp();
129 129
 
130
-    if(!in_array($userIp, $whitelist)){
130
+    if (!in_array($userIp, $whitelist)) {
131 131
 
132 132
       $recaptcha = new \ReCaptcha\ReCaptcha(RECAPTCHA_SECRET);
133 133
       $recaptchaResponse = $recaptcha->verify($captcha, $userIp);
134 134
 
135
-      if(!$recaptchaResponse->isSuccess()) {
135
+      if (!$recaptchaResponse->isSuccess()) {
136 136
         $response = new PhpDraftResponse(false, array());
137 137
         $response->errors = $recaptchaResponse->getErrorCodes();
138 138
         return $app->json($response, $response->responseType());
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
   public function ResetPassword(Application $app, Request $request) {
159 159
     $validity = $app['phpdraft.LoginUserValidator']->IsResetPasswordRequestValid($request);
160 160
 
161
-    if(!$validity->success) {
161
+    if (!$validity->success) {
162 162
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
163 163
     }
164 164
 
Please login to merge, or discard this patch.