Passed
Push — master ( 01aead...99d9f0 )
by Matthew
02:52
created
api/Domain/Validators/RoundTimeValidator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,23 +19,23 @@
 block discarded – undo
19 19
     $valid = true;
20 20
     $errors = array();
21 21
 
22
-    if($model->isRoundTimesEnabled) {
22
+    if ($model->isRoundTimesEnabled) {
23 23
       $roundTimeNumber = 0;
24
-      foreach($model->roundTimes as $roundTime) {
24
+      foreach ($model->roundTimes as $roundTime) {
25 25
         $roundTimeNumber++;
26 26
 
27
-        if(empty($roundTime->draft_id) ||
27
+        if (empty($roundTime->draft_id) ||
28 28
           empty($roundTime->round_time_seconds)) {
29 29
           $errors[] = "Round time #$roundTimeNumber has one or more missing fields.";
30 30
           $valid = false;
31 31
         }
32 32
 
33
-        if($roundTime->round_time_seconds <= 0) {
33
+        if ($roundTime->round_time_seconds <= 0) {
34 34
           $errors[] = "Round time #$roundTimeNumber must have 1 or more seconds specified.";
35 35
           $valid = false;
36 36
         }
37 37
 
38
-        if(!$roundTime->is_static_time && ($roundTime->draft_round < 1 || $roundTime->draft_round > 30)) {
38
+        if (!$roundTime->is_static_time && ($roundTime->draft_round < 1 || $roundTime->draft_round > 30)) {
39 39
           $errors[] = "Round time #$roundTimeNumber cannot have a round less than 1 or greater than 30.";
40 40
           $valid = false;
41 41
         }
Please login to merge, or discard this patch.
api/Domain/Validators/LoginUserValidator.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     $name = $request->get('_name');
25 25
     $recaptcha = $request->get('_recaptcha');
26 26
 
27
-    if(empty($password)
27
+    if (empty($password)
28 28
       || empty($confirmPassword)
29 29
       || empty($emailAddress)
30 30
       || empty($name)
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     $this->validateEmailAddress($emailAddress, $errors, $valid);
43 43
 
44
-    if(!$this->app['phpdraft.LoginUserRepository']->NameIsUnique($name)) {
44
+    if (!$this->app['phpdraft.LoginUserRepository']->NameIsUnique($name)) {
45 45
       $errors[] = "Name already taken.";
46 46
       $valid = false;
47 47
     }
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
     $emailAddress = $request->get('_email');
59 59
     $verificationToken = $this->app['phpdraft.SaltService']->UrlDecodeSalt($request->get('_verificationToken'));
60 60
 
61
-    if(strlen($verificationToken) != 16) {
61
+    if (strlen($verificationToken) != 16) {
62 62
       $errors[] = "Verification token invalid.";
63 63
       $valid = false;
64 64
     }
65 65
 
66 66
     $this->validateEmailAddress($emailAddress, $errors, $valid);
67 67
 
68
-    if(!$this->app['phpdraft.LoginUserRepository']->VerificationMatches($emailAddress, $verificationToken)) {
68
+    if (!$this->app['phpdraft.LoginUserRepository']->VerificationMatches($emailAddress, $verificationToken)) {
69 69
       $errors[] = "Verification token invalid.";
70 70
       $valid = false;
71 71
     }
@@ -99,18 +99,18 @@  discard block
 block discarded – undo
99 99
     $valid = true;
100 100
     $errors = array();
101 101
 
102
-    if(empty($emailAddress)
102
+    if (empty($emailAddress)
103 103
       || empty($verificationToken)) {
104 104
       $errors[] = "One or more missing fields";
105 105
       $valid = false;
106 106
     }
107 107
 
108
-    if(strlen($verificationToken) != 16) {
108
+    if (strlen($verificationToken) != 16) {
109 109
       $errors[] = "Verification token invalid.";
110 110
       $valid = false;
111 111
     }
112 112
 
113
-    if(!$this->app['phpdraft.LoginUserRepository']->VerificationMatches($emailAddress, $verificationToken)) {
113
+    if (!$this->app['phpdraft.LoginUserRepository']->VerificationMatches($emailAddress, $verificationToken)) {
114 114
       $errors[] = "Verification token invalid.";
115 115
       $valid = false;
116 116
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     $confirmPassword = $request->get('_confirmPassword');
132 132
     $verificationToken = $this->app['phpdraft.SaltService']->UrlDecodeSalt($request->get('_verificationToken'));
133 133
 
134
-    if(empty($emailAddress)
134
+    if (empty($emailAddress)
135 135
       || empty($password)
136 136
       || empty($confirmPassword)
137 137
       || empty($verificationToken)) {
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
       $valid = false;
140 140
     }
141 141
 
142
-    if(strlen($verificationToken) != 16) {
142
+    if (strlen($verificationToken) != 16) {
143 143
       $errors[] = "Verification token invalid.";
144 144
       $valid = false;
145 145
     }
146 146
 
147
-    if(!$this->app['phpdraft.LoginUserRepository']->VerificationMatches($emailAddress, $verificationToken)) {
147
+    if (!$this->app['phpdraft.LoginUserRepository']->VerificationMatches($emailAddress, $verificationToken)) {
148 148
       $errors[] = "Verification token invalid.";
149 149
       $valid = false;
150 150
     }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
     $currentUser = $this->app['phpdraft.LoginUserService']->GetCurrentUser();
174 174
 
175
-    if(empty($currentUser) || $currentUser == null) {
175
+    if (empty($currentUser) || $currentUser == null) {
176 176
       $valid = false;
177 177
       $errors[] = "Invalid user.";
178 178
 
@@ -181,38 +181,38 @@  discard block
 block discarded – undo
181 181
     }
182 182
 
183 183
     //Password required to make any changes
184
-    if(empty($password) || !$this->app['security.encoder.digest']->isPasswordValid($currentUser->password, $password, $currentUser->salt)) {
184
+    if (empty($password) || !$this->app['security.encoder.digest']->isPasswordValid($currentUser->password, $password, $currentUser->salt)) {
185 185
       $errors[] = "Incorrect password entered.";
186 186
       $valid = false;
187 187
     }
188 188
 
189 189
     //Need to verify new email
190
-    if(empty($emailAddress)) {
190
+    if (empty($emailAddress)) {
191 191
       $errors[] = "Email address is missing.";
192 192
       $valid = false;
193
-    } else if(!$this->app['phpdraft.StringsEqual']($emailAddress, $currentUser->email)) {
193
+    } else if (!$this->app['phpdraft.StringsEqual']($emailAddress, $currentUser->email)) {
194 194
       $this->validateEmailAddress($emailAddress, $errors, $valid);
195 195
 
196 196
       $this->validateUniqueEmail($emailAddress, $errors, $valid);
197 197
     }
198 198
 
199 199
     //Need to verify new password, ensure old password is correct
200
-    if(!empty($newPassword)) {
200
+    if (!empty($newPassword)) {
201 201
       $this->validatePasswordLength($newPassword, $errors, $valid);
202 202
 
203 203
       $this->validatePasswordsMatch($newPassword, $newConfirmedPassword, $errors, $valid);
204 204
     }
205 205
 
206 206
     //If the name has changed, ensure the new one is valid and unique
207
-    if($currentUser->name != $name) {
208
-      if(empty($name)) {
207
+    if ($currentUser->name != $name) {
208
+      if (empty($name)) {
209 209
         $errors[] = "Name is required.";
210 210
         $valid = false;
211 211
       }
212 212
 
213 213
       $this->validateNameLength($name, $errors, $valid);
214 214
 
215
-      if(!$this->app['phpdraft.LoginUserRepository']->NameIsUnique($name)) {
215
+      if (!$this->app['phpdraft.LoginUserRepository']->NameIsUnique($name)) {
216 216
         $errors[] = "Name already taken.";
217 217
         $valid = false;
218 218
       }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
     $loadedUser = $this->app['phpdraft.LoginUserRepository']->LoadById($user->id);
229 229
 
230
-    if($user->id == 0 || empty($loadedUser)) {
230
+    if ($user->id == 0 || empty($loadedUser)) {
231 231
       $valid = false;
232 232
       $errors[] = "Invalid user.";
233 233
 
@@ -236,21 +236,21 @@  discard block
 block discarded – undo
236 236
     }
237 237
 
238 238
     //Need to verify new email
239
-    if(empty($user->email)) {
239
+    if (empty($user->email)) {
240 240
       $errors[] = "Email address is missing.";
241 241
       $valid = false;
242
-    } else if(!$this->app['phpdraft.StringsEqual']($user->email, $loadedUser->email)) {
242
+    } else if (!$this->app['phpdraft.StringsEqual']($user->email, $loadedUser->email)) {
243 243
       $this->validateEmailAddress($user->email, $errors, $valid);
244 244
 
245 245
       $this->validateUniqueEmail($user->email, $errors, $valid);
246 246
     }
247 247
 
248
-    if(strlen($user->name) > 100) {
248
+    if (strlen($user->name) > 100) {
249 249
       $errors[] = "Name is above maximum length";
250 250
       $valid = false;
251 251
     }
252 252
 
253
-    if(!$this->app['phpdraft.LoginUserRepository']->NameIsUnique($user->name, $user->id)) {
253
+    if (!$this->app['phpdraft.LoginUserRepository']->NameIsUnique($user->name, $user->id)) {
254 254
       $errors[] = "Name already taken.";
255 255
       $valid = false;
256 256
     }
@@ -259,47 +259,47 @@  discard block
 block discarded – undo
259 259
   }
260 260
 
261 261
   private function validatePasswordsMatch($password1, $password2, &$errors, &$valid) {
262
-    if(!$this->app['phpdraft.StringsEqual']($password1, $password2)) {
262
+    if (!$this->app['phpdraft.StringsEqual']($password1, $password2)) {
263 263
       $errors[] = "Password values do not match.";
264 264
       $valid = false;
265 265
     }
266 266
   }
267 267
 
268 268
   private function validateUniqueEmail($emailAddress, &$errors, &$valid) {
269
-    if(!$this->app['phpdraft.LoginUserRepository']->EmailIsUnique($emailAddress)) {
269
+    if (!$this->app['phpdraft.LoginUserRepository']->EmailIsUnique($emailAddress)) {
270 270
       $errors[] = "Email already registered.";
271 271
       $valid = false;
272 272
     }
273 273
   }
274 274
 
275 275
   private function validateEmailExists($emailAddress, &$errors, &$valid) {
276
-    if(!$this->app['phpdraft.LoginUserRepository']->EmailExists($emailAddress)) {
276
+    if (!$this->app['phpdraft.LoginUserRepository']->EmailExists($emailAddress)) {
277 277
       $errors[] = "Email invalid.";
278 278
       $valid = false;
279 279
     }
280 280
   }
281 281
 
282 282
   private function validateEmailAddress($emailAddress, &$errors, &$valid) {
283
-    if(!$this->app['phpdraft.EmailValidator']->isValid($emailAddress) || strlen($emailAddress) > 255) {
283
+    if (!$this->app['phpdraft.EmailValidator']->isValid($emailAddress) || strlen($emailAddress) > 255) {
284 284
       $errors[] = "Email invalid.";
285 285
       $valid = false;
286 286
     }
287 287
   }
288 288
 
289 289
   private function validatePasswordLength($password, &$errors, &$valid) {
290
-    if(strlen($password) < 8) {
290
+    if (strlen($password) < 8) {
291 291
       $errors[] = "Password is below minimum length.";
292 292
       $valid = false;
293 293
     }
294 294
 
295
-    if(strlen($password) > 255) {
295
+    if (strlen($password) > 255) {
296 296
       $errors[] = "Password is above maximum length.";
297 297
       $valid = false;
298 298
     }
299 299
   }
300 300
 
301 301
   private function validateNameLength($name, &$errors, &$valid) {
302
-    if(strlen($name) > 100) {
302
+    if (strlen($name) > 100) {
303 303
       $errors[] = "Name is above maximum length";
304 304
       $valid = false;
305 305
     }
Please login to merge, or discard this patch.
api/Domain/Validators/PickValidator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     $teams = $this->app['phpdraft.DraftDataRepository']->GetTeams($draft->draft_sport);
21 21
     $positions = $this->app['phpdraft.DraftDataRepository']->GetPositions($draft->draft_sport);
22 22
 
23
-    if(empty($pick->first_name)
23
+    if (empty($pick->first_name)
24 24
       || empty($pick->last_name)
25 25
       || empty($pick->team)
26 26
       || empty($pick->position)) {
@@ -28,32 +28,32 @@  discard block
 block discarded – undo
28 28
       $valid = false;
29 29
     }
30 30
 
31
-    if($pick->draft_id != $draft->draft_id) {
31
+    if ($pick->draft_id != $draft->draft_id) {
32 32
       $errors[] = "Pick does not belong to draft #$draft->draft_id.";
33 33
       $valid = false;
34 34
     }
35 35
 
36
-    if(strlen($pick->first_name) > 255) {
36
+    if (strlen($pick->first_name) > 255) {
37 37
       $errors[] = "First name is above maximum length.";
38 38
       $valid = false;
39 39
     }
40 40
 
41
-    if(strlen($pick->last_name) > 255) {
41
+    if (strlen($pick->last_name) > 255) {
42 42
       $errors[] = "Last name is above maximum length.";
43 43
       $valid = false;
44 44
     }
45 45
 
46
-    if($draft->draft_current_pick != $pick->player_pick) {
46
+    if ($draft->draft_current_pick != $pick->player_pick) {
47 47
       $errors[] = "Pick #$pick->player_pick is not the current pick for draft #$draft->draft_id.";
48 48
       $valid = false;
49 49
     }
50 50
 
51
-    if(!array_key_exists($pick->team, $teams)) {
51
+    if (!array_key_exists($pick->team, $teams)) {
52 52
       $errors[] = "Team $pick->team is an invalid value.";
53 53
       $valid = false;
54 54
     }
55 55
 
56
-    if(!array_key_exists($pick->position, $positions)) {
56
+    if (!array_key_exists($pick->position, $positions)) {
57 57
       $errors[] = "Position $pick->position is an invalid value.";
58 58
       $valid = false;
59 59
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     $teams = $this->app['phpdraft.DraftDataRepository']->GetTeams($draft->draft_sport);
68 68
     $positions = $this->app['phpdraft.DraftDataRepository']->GetPositions($draft->draft_sport);
69 69
 
70
-    if(empty($pick->first_name)
70
+    if (empty($pick->first_name)
71 71
       || empty($pick->last_name)
72 72
       || empty($pick->team)
73 73
       || empty($pick->position)) {
@@ -75,27 +75,27 @@  discard block
 block discarded – undo
75 75
       $valid = false;
76 76
     }
77 77
 
78
-    if($pick->draft_id != $draft->draft_id) {
78
+    if ($pick->draft_id != $draft->draft_id) {
79 79
       $errors[] = "Pick does not belong to draft #$draft->draft_id.";
80 80
       $valid = false;
81 81
     }
82 82
 
83
-    if(strlen($pick->first_name) > 255) {
83
+    if (strlen($pick->first_name) > 255) {
84 84
       $errors[] = "First name is above maximum length.";
85 85
       $valid = false;
86 86
     }
87 87
 
88
-    if(strlen($pick->last_name) > 255) {
88
+    if (strlen($pick->last_name) > 255) {
89 89
       $errors[] = "Last name is above maximum length.";
90 90
       $valid = false;
91 91
     }
92 92
 
93
-    if(!array_key_exists($pick->team, $teams)) {
93
+    if (!array_key_exists($pick->team, $teams)) {
94 94
       $errors[] = "Team $pick->team is an invalid value.";
95 95
       $valid = false;
96 96
     }
97 97
 
98
-    if(!array_key_exists($pick->position, $positions)) {
98
+    if (!array_key_exists($pick->position, $positions)) {
99 99
       $errors[] = "Position $pick->position is an invalid value.";
100 100
       $valid = false;
101 101
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     $valid = true;
108 108
     $errors = array();
109 109
 
110
-    if($pick->draft_id != $draft->draft_id) {
110
+    if ($pick->draft_id != $draft->draft_id) {
111 111
       $errors[] = "Pick does not belong to draft #$draft->draft_id.";
112 112
       $valid = false;
113 113
     }
Please login to merge, or discard this patch.
api/Domain/Validators/ProPlayerValidator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@
 block discarded – undo
20 20
     $errors = array();
21 21
     $sports = $this->app['phpdraft.DraftDataRepository']->GetSports();
22 22
 
23
-    if(empty($sport)) {
23
+    if (empty($sport)) {
24 24
       $errors[] = "One or more missing fields.";
25 25
       $valid = false;
26 26
     }
27 27
 
28
-    if(!array_key_exists($sport, $sports)) {
28
+    if (!array_key_exists($sport, $sports)) {
29 29
       $errors[] = "Sport $sport is an invalid value.";
30 30
       $valid = false;
31 31
     }
32 32
 
33 33
     if (!isset($file)) {
34 34
       $valid = false;
35
-      $errors[] =  "Must upload a CSV file";
35
+      $errors[] = "Must upload a CSV file";
36 36
     } else {
37 37
       if ($file->getError() > 0) {
38 38
         $valid = false;
Please login to merge, or discard this patch.
api/Domain/Validators/DepthChartPositionValidator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     $errors = array();
18 18
     $draft_sports = $this->app['phpdraft.DraftDataRepository']->GetSports();
19 19
 
20
-    if(strlen($draft_sport) < 3 || strlen($draft_sport) > 4 || strlen($draft_sports[$draft_sport]) == 0) {
20
+    if (strlen($draft_sport) < 3 || strlen($draft_sport) > 4 || strlen($draft_sports[$draft_sport]) == 0) {
21 21
       $errors[] = "Draft sport is an invalid value.";
22 22
       $valid = false;
23 23
     }
@@ -29,28 +29,28 @@  discard block
 block discarded – undo
29 29
     $valid = true;
30 30
     $errors = array();
31 31
 
32
-    if(count($depthChartPositionCreateModel->positions) !== count(array_unique($depthChartPositionCreateModel->positions))) {
32
+    if (count($depthChartPositionCreateModel->positions) !== count(array_unique($depthChartPositionCreateModel->positions))) {
33 33
       $valid = false;
34 34
       $errors[] = "One or more of the positions are not unique.";
35 35
     }
36 36
 
37 37
     $rounds = 0;
38 38
 
39
-    foreach($depthChartPositionCreateModel->positions as $depthChartPosition) {
39
+    foreach ($depthChartPositionCreateModel->positions as $depthChartPosition) {
40 40
       $rounds += (int)$depthChartPosition->slots;
41 41
     }
42 42
 
43
-    if($rounds == 0) {
43
+    if ($rounds == 0) {
44 44
       $valid = false;
45 45
       $errors[] = "The depth chart positions must specify at least 1 slot";
46 46
     }
47 47
 
48
-    if($rounds > 30) {
48
+    if ($rounds > 30) {
49 49
       $valid = false;
50 50
       $errors[] = "The depth chart positions cannot specify more than 30 slots in total.";
51 51
     }
52 52
 
53
-    if(count($depthChartPositionCreateModel->positions) > 30) {
53
+    if (count($depthChartPositionCreateModel->positions) > 30) {
54 54
       $valid = false;
55 55
       $errors[] = "Too many depth chart positions have been provided - 30 is the maximum.";
56 56
     }
Please login to merge, or discard this patch.
api/Domain/Validators/DraftValidator.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
     $current_user = $this->app['phpdraft.LoginUserService']->GetUserFromHeaderToken($request);
22 22
     $draft_password = $request->headers->get(DRAFT_PASSWORD_HEADER, '');
23 23
 
24
-    if($current_user != null && ($draft->commish_id == $current_user->id || $this->app['phpdraft.LoginUserService']->CurrentUserIsAdmin($current_user))) {
24
+    if ($current_user != null && ($draft->commish_id == $current_user->id || $this->app['phpdraft.LoginUserService']->CurrentUserIsAdmin($current_user))) {
25 25
       return true;
26 26
     }
27 27
 
28
-    if(empty($draft->draft_password) || ($draft->draft_password == $draft_password)) {
28
+    if (empty($draft->draft_password) || ($draft->draft_password == $draft_password)) {
29 29
       return true;
30 30
     }
31 31
 
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
   }
34 34
 
35 35
   public function IsDraftEditableForUser(Draft $draft, LoginUser $current_user) {
36
-    if(!empty($current_user) && !empty($draft) && $draft->commish_id == $current_user->id) {
36
+    if (!empty($current_user) && !empty($draft) && $draft->commish_id == $current_user->id) {
37 37
       return true;
38 38
     }
39 39
 
40
-    if(!empty($current_user) && $this->app['phpdraft.LoginUserService']->CurrentUserIsAdmin($current_user)) {
40
+    if (!empty($current_user) && $this->app['phpdraft.LoginUserService']->CurrentUserIsAdmin($current_user)) {
41 41
       return true;
42 42
     }
43 43
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $draft_sports = $this->app['phpdraft.DraftDataRepository']->GetSports();
51 51
     $draft_styles = $this->app['phpdraft.DraftDataRepository']->GetStyles();
52 52
 
53
-    if(empty($draft->commish_id)
53
+    if (empty($draft->commish_id)
54 54
       || empty($draft->draft_name)
55 55
       || empty($draft->draft_sport)
56 56
       || empty($draft->draft_style)) {
@@ -58,33 +58,33 @@  discard block
 block discarded – undo
58 58
       $valid = false;
59 59
     }
60 60
 
61
-    if(!empty($draft->draft_password) && strlen($draft->draft_password) > 255) {
61
+    if (!empty($draft->draft_password) && strlen($draft->draft_password) > 255) {
62 62
       $errors[] = "Password is above maximum length.";
63 63
       $valid = false;
64 64
     }
65 65
 
66
-    if(strlen($draft->draft_name) > 255) {
66
+    if (strlen($draft->draft_name) > 255) {
67 67
       $errors[] = "Draft name is above maximum length";
68 68
       $valid = false;
69 69
     }
70 70
 
71
-    if(strlen($draft->draft_sport) < 3 || strlen($draft->draft_sport) > 4 || strlen($draft_sports[$draft->draft_sport]) == 0) {
71
+    if (strlen($draft->draft_sport) < 3 || strlen($draft->draft_sport) > 4 || strlen($draft_sports[$draft->draft_sport]) == 0) {
72 72
       $errors[] = "Draft sport is an invalid value.";
73 73
       $valid = false;
74 74
     }
75 75
 
76
-    if(!array_key_exists($draft->draft_style, $draft_styles)) {
76
+    if (!array_key_exists($draft->draft_style, $draft_styles)) {
77 77
 
78 78
       $errors[] = "Draft style is an invalid value.";
79 79
       $valid = false;
80 80
     }
81 81
 
82
-    if(!$this->app['phpdraft.DraftRepository']->NameIsUnique($draft->draft_name, $draft->draft_id)) {
82
+    if (!$this->app['phpdraft.DraftRepository']->NameIsUnique($draft->draft_name, $draft->draft_id)) {
83 83
       $errors[] = "Draft name is already taken, please choose a different name.";
84 84
       $valid = false;
85 85
     }
86 86
 
87
-    if($draft->draft_rounds < 1 || $draft->draft_rounds > 30) {
87
+    if ($draft->draft_rounds < 1 || $draft->draft_rounds > 30) {
88 88
       $errors[] = "Invalid number of draft rounds.";
89 89
       $valid = false;
90 90
     }
@@ -97,27 +97,27 @@  discard block
 block discarded – undo
97 97
     $errors = array();
98 98
     $draft_statuses = $this->app['phpdraft.DraftDataRepository']->GetStatuses();
99 99
 
100
-    if($old_status == "complete") {
100
+    if ($old_status == "complete") {
101 101
       $valid = false;
102 102
       $errors[] = "The draft is completed, therefore its status cannot be changed.";
103 103
     }
104 104
 
105
-    if($draft->draft_status == "complete") {
105
+    if ($draft->draft_status == "complete") {
106 106
       $valid = false;
107 107
       $errors[] = "You cannot set the draft as completed manually.";
108 108
     }
109 109
 
110
-    if(empty($draft->draft_status)) {
110
+    if (empty($draft->draft_status)) {
111 111
       $errors[] = "One or more missing fields.";
112 112
       $valid = false;
113 113
     }
114 114
 
115
-    if(!array_key_exists($draft->draft_status, $draft_statuses)) {
115
+    if (!array_key_exists($draft->draft_status, $draft_statuses)) {
116 116
       $errors[] = "Draft status is an invalid value.";
117 117
       $valid = false;
118 118
     }
119 119
 
120
-    if($draft->draft_status == "in_progress" && !$this->app['phpdraft.ManagerRepository']->DraftHasManagers($draft->draft_id)) {
120
+    if ($draft->draft_status == "in_progress" && !$this->app['phpdraft.ManagerRepository']->DraftHasManagers($draft->draft_id)) {
121 121
       $valid = false;
122 122
       $errors[] = "A draft must have at least 2 managers before it can begin.";
123 123
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     $current_status_text = strtolower($draft_statuses[$draft->draft_status]);
133 133
     $is_setting_up = $this->app['phpdraft.DraftService']->DraftSettingUp($draft);
134 134
 
135
-    if(!$is_setting_up) {
135
+    if (!$is_setting_up) {
136 136
       $valid = false;
137 137
       $errors[] = "Unable to work on draft #$draft->draft_id: draft is $current_status_text";
138 138
     }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     $is_setting_up = $this->app['phpdraft.DraftService']->DraftSettingUp($draft);
149 149
     $is_in_progress = $this->app['phpdraft.DraftService']->DraftInProgress($draft);
150 150
 
151
-    if(!$is_setting_up && !$is_in_progress) {
151
+    if (!$is_setting_up && !$is_in_progress) {
152 152
       $valid = false;
153 153
       $errors[] = "Unable to work on draft #$draft->draft_id: draft is $current_status_text";
154 154
     }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     $current_status_text = strtolower($draft_statuses[$draft->draft_status]);
164 164
     $is_in_progress = $this->app['phpdraft.DraftService']->DraftInProgress($draft);
165 165
 
166
-    if(!$is_in_progress) {
166
+    if (!$is_in_progress) {
167 167
       $valid = false;
168 168
       $errors[] = "Unable to work on draft #$draft->draft_id: draft is $current_status_text";
169 169
     }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     $is_in_progress = $this->app['phpdraft.DraftService']->DraftInProgress($draft);
180 180
     $is_complete = $this->app['phpdraft.DraftService']->DraftComplete($draft);
181 181
 
182
-    if(!$is_complete && !$is_in_progress) {
182
+    if (!$is_complete && !$is_in_progress) {
183 183
       $valid = false;
184 184
       $errors[] = "Unable to work on draft #$draft->draft_id: draft is $current_status_text";
185 185
     }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     $is_complete = $this->app['phpdraft.DraftService']->DraftComplete($draft);
197 197
     $isLessThanTenMinutes = false;
198 198
 
199
-    if($is_complete) {
199
+    if ($is_complete) {
200 200
       $utc_timezone = new \DateTimeZone("UTC");
201 201
       $now_utc = new \DateTime(null, $utc_timezone);
202 202
       $end_time = new \DateTime($draft->draft_end_time, $utc_timezone);
@@ -204,17 +204,17 @@  discard block
 block discarded – undo
204 204
       $end_seconds = $end_time->getTimestamp();
205 205
       $seconds_elapsed = $end_seconds - $now_seconds;
206 206
 
207
-      if($seconds_elapsed < 600) {
207
+      if ($seconds_elapsed < 600) {
208 208
         $isLessThanTenMinutes = true;
209 209
       }
210 210
     }
211 211
 
212
-    if(!$is_complete && !$is_in_progress) {
212
+    if (!$is_complete && !$is_in_progress) {
213 213
       $valid = false;
214 214
       $errors[] = "Unable to work on draft #$draft->draft_id: draft is $current_status_text";
215 215
     }
216 216
 
217
-    if($is_complete && !$isLessThanTenMinutes) {
217
+    if ($is_complete && !$isLessThanTenMinutes) {
218 218
       $valid = false;
219 219
       $errors[] = "Unable to work on draft #$draft->draft_id: draft is complete and beyond the ten minute grace period.";
220 220
     }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     $current_status_text = strtolower($draft_statuses[$draft->draft_status]);
230 230
     $is_complete = $this->app['phpdraft.DraftService']->DraftComplete($draft);
231 231
 
232
-    if(!$is_complete) {
232
+    if (!$is_complete) {
233 233
       $valid = false;
234 234
       $errors[] = "Unable to work on draft #$draft->draft_id: draft is $current_status_text";
235 235
     }
Please login to merge, or discard this patch.
api/Domain/Services/UtilityService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
   }
12 12
 
13 13
   public function ConvertTimeForClientDisplay($time_value) {
14
-    if(empty($time_value)) {
14
+    if (empty($time_value)) {
15 15
       return null;
16 16
     }
17 17
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     $supposed_utc_index = $time_value_length > 3 ? $time_value_length - 3 : 0;
20 20
     $utc_index = strstr($time_value, "UTC");
21 21
 
22
-    if($utc_index == $supposed_utc_index) {
22
+    if ($utc_index == $supposed_utc_index) {
23 23
       return $time_value;
24 24
     } else {
25 25
       return $time_value . " UTC";
Please login to merge, or discard this patch.
api/Domain/Services/DepthChartPositionService.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@
 block discarded – undo
30 30
 
31 31
       $unassignedPicks = array();
32 32
 
33
-      foreach($allManagerPicks as $pick) {
34
-        if(is_null($pick->depth_chart_position_id)) {
33
+      foreach ($allManagerPicks as $pick) {
34
+        if (is_null($pick->depth_chart_position_id)) {
35 35
           $unassignedPicks[] = $pick;
36 36
         }
37 37
       }
38 38
 
39 39
       $response->depthChartPositions[] = new DepthChartDisplayModel(null, 'Unassigned', null, $unassignedPicks);
40 40
 
41
-      foreach($depthChartPositions as $position) {
41
+      foreach ($depthChartPositions as $position) {
42 42
         $picks = array();
43 43
 
44
-        foreach($allManagerPicks as $pick) {
45
-          if($pick->depth_chart_position_id == $position->id) {
44
+        foreach ($allManagerPicks as $pick) {
45
+          if ($pick->depth_chart_position_id == $position->id) {
46 46
             $picks[] = $pick;
47 47
           }
48 48
         }
Please login to merge, or discard this patch.
api/Domain/Services/EmailService.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
     $this->mailer->Host = MAIL_SERVER;
24 24
     $this->mailer->Port = MAIL_PORT;
25 25
 
26
-    if(MAIL_DEVELOPMENT != true) {
26
+    if (MAIL_DEVELOPMENT != true) {
27 27
       $this->mailer->SMTPAuth = true;
28 28
       $this->mailer->Username = MAIL_USER;
29 29
       $this->mailer->Password = MAIL_PASS;
30 30
 
31
-      if(MAIL_USE_ENCRYPTION == true) {
31
+      if (MAIL_USE_ENCRYPTION == true) {
32 32
         $this->mailer->SMTPSecure = MAIL_ENCRYPTION;
33 33
       }
34 34
     }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
   }
39 39
 
40 40
   public function SendMail(MailMessage $message) {
41
-    foreach($message->to_addresses as $address => $name) {
41
+    foreach ($message->to_addresses as $address => $name) {
42 42
       $this->mailer->addAddress($address, $name);
43 43
     }
44 44
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     $this->mailer->Body = $message->body;
50 50
 
51
-    if(!$this->mailer->send()) {
51
+    if (!$this->mailer->send()) {
52 52
       throw new \Exception("Unable to send mail: " . $this->mailer->ErrorInfo);
53 53
     }
54 54
 
Please login to merge, or discard this patch.