Completed
Branch master (4f2bb7)
by Matthew
05:01
created
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.
api/Domain/Services/LoginUserService.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
   public function GetCurrentUser() {
20 20
     $token = $this->app['security.token_storage']->getToken();
21 21
 
22
-    if($token == null) {
22
+    if ($token == null) {
23 23
       //In public actions, this isn't an exception - we're just not logged in.
24 24
       return null;
25 25
       //throw new \Exception("Username not found.");
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
   //This is a hack to make accessing logged in user info from anonymous routes possible:
34 34
   public function GetUserFromHeaderToken(Request $request) {
35
-    $request_token = $request->headers->get(AUTH_KEY_HEADER,'');
35
+    $request_token = $request->headers->get(AUTH_KEY_HEADER, '');
36 36
 
37
-    if(empty($request_token)) {
37
+    if (empty($request_token)) {
38 38
       return null;
39 39
     }
40 40
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
       $email = $decoded->name;
45 45
 
46 46
       return $this->app['phpdraft.LoginUserRepository']->Load($email);
47
-    }catch(\Exception $ex) {
47
+    } catch (\Exception $ex) {
48 48
       return null;
49 49
     }
50 50
   }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     try {
56 56
       $response->commissioners = $this->app['phpdraft.LoginUserRepository']->SearchCommissioners($searchTerm);
57 57
       $response->success = true;
58
-    } catch(\Exception $ex) {
58
+    } catch (\Exception $ex) {
59 59
       $message = $ex->getMessage();
60 60
       $response->success = false;
61 61
       $response->errors[] = $message;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     try {
71 71
       $response->commissioner = $this->app['phpdraft.LoginUserRepository']->LoadPublicById($commish_id);
72 72
       $response->success = true;
73
-    } catch(\Exception $ex) {
73
+    } catch (\Exception $ex) {
74 74
       $message = $ex->getMessage();
75 75
       $response->success = false;
76 76
       $response->errors[] = $message;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
       $response->users = $this->app['phpdraft.LoginUserRepository']->LoadAll();
87 87
       $response->roles = $this->app['phpdraft.LoginUserRepository']->GetRoles();
88 88
       $response->success = true;
89
-    } catch(\Exception $e) {
89
+    } catch (\Exception $e) {
90 90
       $message = $e->getMessage();
91 91
       $response->success = false;
92 92
       $response->errors[] = $message;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
       $message = new MailMessage();
111 111
 
112
-      $message->to_addresses = array (
112
+      $message->to_addresses = array(
113 113
         $user->email => $user->name
114 114
       );
115 115
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
       $this->app['phpdraft.EmailService']->SendMail($message);
129 129
 
130 130
       $response->success = true;
131
-    }catch(\Exception $e) {
131
+    } catch (\Exception $e) {
132 132
       //$this->app['db']->rollback();
133 133
 
134 134
       $response->success = false;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     $user->verificationKey = $this->app['phpdraft.SaltService']->GenerateSalt();
152 152
 
153 153
     //Found out that forward slashes are no good for URLs. Go figure.
154
-    while(strpos($user->verificationKey, '/') != 0) {
154
+    while (strpos($user->verificationKey, '/') != 0) {
155 155
       $user->verificationKey = $this->app['phpdraft.SaltService']->GenerateSalt();
156 156
     }
157 157
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
       $message = new MailMessage();
166 166
 
167
-      $message->to_addresses = array (
167
+      $message->to_addresses = array(
168 168
         $user->email => $user->name
169 169
       );
170 170
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
       $response->success = true;
188 188
 
189 189
       $this->app['db']->commit();
190
-    }catch(\Exception $e) {
190
+    } catch (\Exception $e) {
191 191
       $this->app['db']->rollback();
192 192
 
193 193
       $response->success = false;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
       $response->success = true;
213 213
 
214 214
       $this->app['db']->commit();
215
-    }catch(\Exception $e) {
215
+    } catch (\Exception $e) {
216 216
       $this->app['db']->rollback();
217 217
 
218 218
       $response->success = false;
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     $user->name = $name;
235 235
 
236 236
     //Update user email, invalidate login
237
-    if(!empty($email) && !StringUtils::equals($email, $user->email)) {
237
+    if (!empty($email) && !StringUtils::equals($email, $user->email)) {
238 238
       $user->email = $email;
239 239
       $user->enabled = false;
240 240
       $invalidateLogin = true;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
       $sendEmail = true;
243 243
     }
244 244
 
245
-    if(!empty($newPassword)) {
245
+    if (!empty($newPassword)) {
246 246
       $invalidateLogin = true;
247 247
       $user->salt = $this->app['phpdraft.SaltService']->GenerateSalt();
248 248
       $user->password = $this->app['security.encoder.digest']->encodePassword($newPassword, $user->salt);
@@ -250,15 +250,15 @@  discard block
 block discarded – undo
250 250
 
251 251
     $response = new PhpDraftResponse();
252 252
 
253
-    try{
253
+    try {
254 254
       $this->app['db']->beginTransaction();
255 255
 
256 256
       $user = $this->app['phpdraft.LoginUserRepository']->Update($user);
257 257
 
258
-      if($sendEmail) {
258
+      if ($sendEmail) {
259 259
         $message = new MailMessage();
260 260
 
261
-        $message->to_addresses = array (
261
+        $message->to_addresses = array(
262 262
           $user->email => $user->name
263 263
         );
264 264
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
       $response->sendEmail = $sendEmail;
283 283
 
284 284
       $this->app['db']->commit();
285
-    }catch(\Exception $e) {
285
+    } catch (\Exception $e) {
286 286
       $this->app['db']->rollback();
287 287
 
288 288
       $response->success = false;
@@ -298,16 +298,16 @@  discard block
 block discarded – undo
298 298
     try {
299 299
       //Find all drafts this user owns
300 300
       $drafts = $this->app['phpdraft.DraftRepository']->GetAllDraftsByCommish($user->id);
301
-      foreach($drafts as $draft) {
301
+      foreach ($drafts as $draft) {
302 302
         $response = $this->app['phpdraft.DraftService']->DeleteDraft($draft);
303
-        if(!$response->success) {
303
+        if (!$response->success) {
304 304
           throw new \Exception("Unable to recursively delete draft or one of its children.");
305 305
         }
306 306
       }
307 307
       $this->app['phpdraft.LoginUserRepository']->Delete($user);
308 308
 
309 309
       $response->success = true;
310
-    } catch(\Exception $e) {
310
+    } catch (\Exception $e) {
311 311
       $message = $e->getMessage();
312 312
       $response->success = false;
313 313
       $response->errors[] = $message;
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
       $email = $decoded->name;
45 45
 
46 46
       return $this->app['phpdraft.LoginUserRepository']->Load($email);
47
-    }catch(\Exception $ex) {
47
+    } catch(\Exception $ex) {
48 48
       return null;
49 49
     }
50 50
   }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
       $this->app['phpdraft.EmailService']->SendMail($message);
129 129
 
130 130
       $response->success = true;
131
-    }catch(\Exception $e) {
131
+    } catch(\Exception $e) {
132 132
       //$this->app['db']->rollback();
133 133
 
134 134
       $response->success = false;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
       $response->success = true;
188 188
 
189 189
       $this->app['db']->commit();
190
-    }catch(\Exception $e) {
190
+    } catch(\Exception $e) {
191 191
       $this->app['db']->rollback();
192 192
 
193 193
       $response->success = false;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
       $response->success = true;
213 213
 
214 214
       $this->app['db']->commit();
215
-    }catch(\Exception $e) {
215
+    } catch(\Exception $e) {
216 216
       $this->app['db']->rollback();
217 217
 
218 218
       $response->success = false;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
       $response->sendEmail = $sendEmail;
283 283
 
284 284
       $this->app['db']->commit();
285
-    }catch(\Exception $e) {
285
+    } catch(\Exception $e) {
286 286
       $this->app['db']->rollback();
287 287
 
288 288
       $response->success = false;
Please login to merge, or discard this patch.
api/Domain/Models/PhpDraftResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
   public $success;
14 14
   public $errors;
15 15
 
16
-  public function responseType($successResponse = Response::HTTP_OK){
16
+  public function responseType($successResponse = Response::HTTP_OK) {
17 17
     return $this->success
18 18
       ? $successResponse
19 19
       : Response::HTTP_BAD_REQUEST;
Please login to merge, or discard this patch.
api/Domain/Repositories/RoundTimeRepository.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,23 +27,23 @@  discard block
 block discarded – undo
27 27
     $timerStmt->setFetchMode(\PDO::FETCH_CLASS, '\PhpDraft\Domain\Entities\RoundTime');
28 28
     $timerStmt->bindParam(1, $draftId);
29 29
 
30
-    if(!$timerStmt->execute()) {
30
+    if (!$timerStmt->execute()) {
31 31
       throw new \Exception("Unable to load round times.");
32 32
     }
33 33
 
34 34
     $timers = array();
35 35
 
36
-    while($timer = $timerStmt->fetch()) {
36
+    while ($timer = $timerStmt->fetch()) {
37 37
       $timers[] = $timer;
38 38
     }
39 39
 
40 40
     $isStaticTime = false;
41 41
 
42
-    if(count($timers) == 1 && $timers[0]->is_static_time) {
42
+    if (count($timers) == 1 && $timers[0]->is_static_time) {
43 43
       $isStaticTime = true;
44 44
     }
45 45
 
46
-    if(empty($timers) || count($timers) != $draft->draft_rounds) {
46
+    if (empty($timers) || count($timers) != $draft->draft_rounds) {
47 47
       $timers = $this->_CoalesceDraftTimers($draft, $timers, $isStaticTime);
48 48
     }
49 49
 
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
   private function _CoalesceDraftTimers(Draft $draft, $existing_timers, $isStaticTime) {
54 54
     $coalescedTimers = array();
55 55
 
56
-    for($i = 0; $i < $draft->draft_rounds; $i++) {
57
-      if($isStaticTime && $i == 0) {
56
+    for ($i = 0; $i < $draft->draft_rounds; $i++) {
57
+      if ($isStaticTime && $i == 0) {
58 58
         $timer = $existing_timers[$i];
59 59
         $timer->draft_round = $i + 1;
60 60
         $coalescedTimers[] = $timer;
61 61
         continue;
62 62
       }
63 63
 
64
-      if(array_key_exists($i, $existing_timers)) {
64
+      if (array_key_exists($i, $existing_timers)) {
65 65
         $coalescedTimers[] = $existing_timers[$i];
66 66
       } else {
67 67
         $newTimer = new RoundTime();
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     $deleteRoundTime = $this->app['db']->prepare("DELETE FROM round_times WHERE draft_id = ?");
106 106
     $deleteRoundTime->bindParam(1, $draftId);
107 107
 
108
-    if(!$deleteRoundTime->execute()) {
108
+    if (!$deleteRoundTime->execute()) {
109 109
       throw new \Exception("Unable to delete round times: " . $this->app['db']->errorInfo());
110 110
     }
111 111
 
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
     $staticRoundTimeStmt->setFetchMode(\PDO::FETCH_INTO, $roundTime);
120 120
     $staticRoundTimeStmt->bindParam(1, $draft->draft_id);
121 121
 
122
-    if(!$staticRoundTimeStmt->execute()) {
122
+    if (!$staticRoundTimeStmt->execute()) {
123 123
       throw new \Exception("Unable to get static round time.");
124 124
     }
125 125
 
126
-    if($staticRoundTimeStmt->rowCount() == 1) {
126
+    if ($staticRoundTimeStmt->rowCount() == 1) {
127 127
       $staticRoundTimeStmt->fetch();
128 128
 
129 129
       return $roundTime;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
       throw new \Exception("Unable to load round time:" . $this->app['db']->errorInfo());
139 139
     }
140 140
 
141
-    if($roundTimeStmt->rowCount() == 0) {
141
+    if ($roundTimeStmt->rowCount() == 0) {
142 142
       return null;
143 143
     }
144 144
 
Please login to merge, or discard this patch.
api/Domain/Repositories/TradeRepository.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $trade->manager1 = $this->app['phpdraft.ManagerRepository']->Load($trade->manager1_id);
32 32
         $trade->manager2 = $this->app['phpdraft.ManagerRepository']->Load($trade->manager2_id);
33 33
         $trade->trade_assets = $this->GetAssets($trade, $trade->manager1, $trade->manager2);
34
-      }catch(\Exception $e) {
34
+      } catch (\Exception $e) {
35 35
         throw new \Exception("Unable to load managers or trade assets: " . $e->getMessage());
36 36
       }
37 37
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     $draft_trade_stmt->bindParam(1, $draft_id);
84 84
     $draft_trade_stmt->setFetchMode(\PDO::FETCH_CLASS, '\PhpDraft\Domain\Entities\Trade');
85 85
 
86
-    if(!$draft_trade_stmt->execute()) {
86
+    if (!$draft_trade_stmt->execute()) {
87 87
       throw new \Exception("Unable to delete trades for draft $draft_id");
88 88
     }
89 89
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 
135 135
     $stmt->bindParam(':trade_id', $trade->trade_id);
136 136
 
137
-    foreach($trade->trade_assets as &$asset) {
137
+    foreach ($trade->trade_assets as &$asset) {
138 138
       $stmt->bindParam(':player_id', $asset->player->player_id);
139 139
       $stmt->bindParam(':oldmanager_id', $asset->oldmanager->manager_id);
140 140
       $stmt->bindParam(':newmanager_id', $asset->newmanager->manager_id);
141 141
       $stmt->bindParam(':was_drafted', $asset->was_drafted);
142 142
 
143
-      if(!$stmt->execute()) {
143
+      if (!$stmt->execute()) {
144 144
         throw new Exception("Unable to save trade asset #$asset->player_id");
145 145
       }
146 146
 
Please login to merge, or discard this patch.
Braces   +19 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $trade->manager1 = $this->app['phpdraft.ManagerRepository']->Load($trade->manager1_id);
32 32
         $trade->manager2 = $this->app['phpdraft.ManagerRepository']->Load($trade->manager2_id);
33 33
         $trade->trade_assets = $this->GetAssets($trade, $trade->manager1, $trade->manager2);
34
-      }catch(\Exception $e) {
34
+      } catch(\Exception $e) {
35 35
         throw new \Exception("Unable to load managers or trade assets: " . $e->getMessage());
36 36
       }
37 37
 
@@ -58,19 +58,22 @@  discard block
 block discarded – undo
58 58
     while ($asset = $stmt->fetch()) {
59 59
       /* @var $asset trade_asset_object */
60 60
       //We must use the protected $newmanager_id and $oldmanager_id because we have just pulled from DB, objs aren't automatic:
61
-      if ($asset->newmanager_id != $manager1->manager_id && $asset->newmanager_id != $manager2->manager_id)
62
-        throw new \Exception('Invalid manager ID for asset: ' . $asset->newmanager_id);
61
+      if ($asset->newmanager_id != $manager1->manager_id && $asset->newmanager_id != $manager2->manager_id) {
62
+              throw new \Exception('Invalid manager ID for asset: ' . $asset->newmanager_id);
63
+      }
63 64
 
64
-      if ($asset->oldmanager_id != $manager1->manager_id && $asset->oldmanager_id != $manager2->manager_id)
65
-        throw new \Exception('Invalid manager ID for asset: ' . $asset->oldmanager_id);
65
+      if ($asset->oldmanager_id != $manager1->manager_id && $asset->oldmanager_id != $manager2->manager_id) {
66
+              throw new \Exception('Invalid manager ID for asset: ' . $asset->oldmanager_id);
67
+      }
66 68
 
67 69
       //Use passed in manager_objects to prevent unneccessary SELECTs to the db:
68 70
       $asset->player = $this->app['phpdraft.PickRepository']->Load($asset->player_id);
69 71
       $asset->newmanager = $asset->newmanager_id == $manager1->manager_id ? $manager1 : $manager2;
70 72
       $asset->oldmanager = $asset->oldmanager_id == $manager1->manager_id ? $manager1 : $manager2;
71 73
 
72
-      if ($asset->player == false || $asset->newmanager == false || $asset->oldmanager == false)
73
-        throw new \Exception('Invalid asset loaded.');
74
+      if ($asset->player == false || $asset->newmanager == false || $asset->oldmanager == false) {
75
+              throw new \Exception('Invalid asset loaded.');
76
+      }
74 77
 
75 78
       $assets[] = $asset;
76 79
     }
@@ -89,8 +92,9 @@  discard block
 block discarded – undo
89 92
 
90 93
     $trades = array();
91 94
 
92
-    while ($trade = $draft_trade_stmt->fetch())
93
-      $trades[] = $trade;
95
+    while ($trade = $draft_trade_stmt->fetch()) {
96
+          $trades[] = $trade;
97
+    }
94 98
 
95 99
     $delete_assets_stmt = $this->app['db']->prepare("DELETE FROM trade_assets WHERE trade_id = :trade_id");
96 100
     $delete_trade_stmt = $this->app['db']->prepare("DELETE FROM trades WHERE trade_id = :trade_id");
@@ -98,13 +102,15 @@  discard block
 block discarded – undo
98 102
     foreach ($trades as $trade) {
99 103
       $delete_assets_stmt->bindValue(":trade_id", $trade->trade_id);
100 104
 
101
-      if (!$delete_assets_stmt->execute())
102
-        throw new \Exception("Unable to delete trade assets for $draft_id.");
105
+      if (!$delete_assets_stmt->execute()) {
106
+              throw new \Exception("Unable to delete trade assets for $draft_id.");
107
+      }
103 108
 
104 109
       $delete_trade_stmt->bindValue(":trade_id", $trade->trade_id);
105 110
 
106
-      if (!$delete_trade_stmt->execute())
107
-        throw new \Exception("Unable to delete trade assets for $draft_id.");
111
+      if (!$delete_trade_stmt->execute()) {
112
+              throw new \Exception("Unable to delete trade assets for $draft_id.");
113
+      }
108 114
     }
109 115
 
110 116
     return;
Please login to merge, or discard this patch.
api/Domain/Repositories/LoginUserRepository.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 
81 81
     $users = array();
82 82
 
83
-    if(!$load_stmt->execute()) {
83
+    if (!$load_stmt->execute()) {
84 84
       throw new \Exception("Unable to load users.");
85 85
     }
86 86
 
87
-    while($user = $load_stmt->fetch()) {
87
+    while ($user = $load_stmt->fetch()) {
88 88
       
89 89
       $users[] = $this->_ScrubUser($user);
90 90
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
       throw new \Exception("Unable to create user.");
110 110
     }
111 111
 
112
-    $user->id = (int) $this->app['db']->lastInsertId();
112
+    $user->id = (int)$this->app['db']->lastInsertId();
113 113
 
114 114
     return $user;
115 115
   }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
     $result = $update_stmt->execute();
149 149
 
150
-    if($result == false) {
150
+    if ($result == false) {
151 151
       throw new \Exception("Unable to erase verification key for user.");
152 152
     }
153 153
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     $delete_stmt = $this->app['db']->prepare("DELETE FROM users WHERE id = ?");
159 159
     $delete_stmt->bindParam(1, $user->id);
160 160
 
161
-    if(!$delete_stmt->execute()) {
161
+    if (!$delete_stmt->execute()) {
162 162
       throw new \Exception("Unable to delete user #$user->id");
163 163
     }
164 164
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
   }
167 167
 
168 168
   public function NameIsUnique($name, $id = null) {
169
-    if($id == null) {
169
+    if ($id == null) {
170 170
       $name_stmt = $this->app['db']->prepare("SELECT name FROM users WHERE name LIKE ?");
171 171
       $name_stmt->bindParam(1, strtolower($name));
172 172
     } else {
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
       $name_stmt->bindParam(2, $id);
176 176
     }
177 177
 
178
-    if(!$name_stmt->execute()) {
178
+    if (!$name_stmt->execute()) {
179 179
       throw new \Exception(sprintf('Name %s is invalid', $name));
180 180
     }
181 181
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
   }
184 184
 
185 185
   public function EmailExists($email, $id = null) {
186
-    if($id == null) {
186
+    if ($id == null) {
187 187
       $email_stmt = $this->app['db']->prepare("SELECT email FROM users WHERE email = ?");
188 188
       $email_stmt->bindParam(1, $email);
189 189
     } else {
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     $email_stmt = $this->app['db']->prepare("SELECT email FROM users WHERE email = ? LIMIT 1");
204 204
     $email_stmt->bindParam(1, strtolower($email));
205 205
 
206
-    if(!$email_stmt->execute()) {
206
+    if (!$email_stmt->execute()) {
207 207
       throw new \Exception(sprintf('Email %s is invalid', $email));
208 208
     }
209 209
 
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 
220 220
     $users = array();
221 221
 
222
-    if(!$search_stmt->execute()) {
222
+    if (!$search_stmt->execute()) {
223 223
       throw new \Exception("Unable to load users");
224 224
     }
225 225
 
226
-    while($user = $search_stmt->fetch()) {
226
+    while ($user = $search_stmt->fetch()) {
227 227
       unset($user->enabled);
228 228
       unset($user->email);
229 229
       unset($user->password);
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     $verification_stmt->bindParam(1, strtolower($email));
243 243
     $verification_stmt->bindParam(2, $verificationKey);
244 244
 
245
-    if(!$verification_stmt->execute()) {
245
+    if (!$verification_stmt->execute()) {
246 246
       throw new \Exception('Verification is invalid.');
247 247
     }
248 248
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,11 +20,13 @@  discard block
 block discarded – undo
20 20
     $load_stmt->setFetchMode(\PDO::FETCH_INTO, $user);
21 21
     $load_stmt->bindParam(1, strtolower($email));
22 22
 
23
-    if (!$load_stmt->execute())
24
-      throw new \Exception(sprintf('Email "%s" does not exist.', $email));
23
+    if (!$load_stmt->execute()) {
24
+          throw new \Exception(sprintf('Email "%s" does not exist.', $email));
25
+    }
25 26
 
26
-    if (!$load_stmt->fetch())
27
-      throw new \Exception(sprintf('Email "%s" does not exist.', $email));
27
+    if (!$load_stmt->fetch()) {
28
+          throw new \Exception(sprintf('Email "%s" does not exist.', $email));
29
+    }
28 30
 
29 31
     return $user;
30 32
   }
@@ -38,11 +40,13 @@  discard block
 block discarded – undo
38 40
     $load_stmt->setFetchMode(\PDO::FETCH_INTO, $user);
39 41
     $load_stmt->bindParam(1, $id);
40 42
 
41
-    if (!$load_stmt->execute())
42
-      throw new \Exception(sprintf('User #%s does not exist.', $id));
43
+    if (!$load_stmt->execute()) {
44
+          throw new \Exception(sprintf('User #%s does not exist.', $id));
45
+    }
43 46
 
44
-    if (!$load_stmt->fetch())
45
-      throw new \Exception(sprintf('User #%s does not exist.', $id));
47
+    if (!$load_stmt->fetch()) {
48
+          throw new \Exception(sprintf('User #%s does not exist.', $id));
49
+    }
46 50
 
47 51
     return $user;
48 52
   }
@@ -56,11 +60,13 @@  discard block
 block discarded – undo
56 60
     $load_stmt->setFetchMode(\PDO::FETCH_INTO, $user);
57 61
     $load_stmt->bindParam(1, $id);
58 62
 
59
-    if (!$load_stmt->execute())
60
-      throw new \Exception(sprintf('User #%s does not exist.', $id));
63
+    if (!$load_stmt->execute()) {
64
+          throw new \Exception(sprintf('User #%s does not exist.', $id));
65
+    }
61 66
 
62
-    if (!$load_stmt->fetch())
63
-      throw new \Exception(sprintf('User #%s does not exist.', $id));
67
+    if (!$load_stmt->fetch()) {
68
+          throw new \Exception(sprintf('User #%s does not exist.', $id));
69
+    }
64 70
 
65 71
     unset($user->enabled);
66 72
     unset($user->email);
Please login to merge, or discard this patch.
api/Domain/Repositories/DraftStatsRepository.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
     $load_stmt->setFetchMode(\PDO::FETCH_INTO, $stats);
23 23
 
24
-    if(!$load_stmt->execute()) {
24
+    if (!$load_stmt->execute()) {
25 25
       throw new \Exception("Unable to load draft stats");
26 26
     }
27 27
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
       return null;
30 30
     }
31 31
 
32
-    if(!$load_stmt->fetch()) {
32
+    if (!$load_stmt->fetch()) {
33 33
       throw new \Exception("Error while loading draft stats");
34 34
     }
35 35
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     $insert_stmt->bindValue(':least_drafted_position', $draft_stats->least_drafted_position);
104 104
     $insert_stmt->bindValue(':least_drafted_position_count', $draft_stats->least_drafted_position_count);
105 105
 
106
-    if(!$insert_stmt->execute()) {
106
+    if (!$insert_stmt->execute()) {
107 107
       throw new \Exception("Unable to insert new draft stats row.");
108 108
     }
109 109
 
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
     $delete_stmt = $this->app['db']->prepare("DELETE FROM draft_stats WHERE draft_id = ?");
119 119
     $delete_stmt->bindParam(1, $draft_id);
120 120
 
121
-    if(!$delete_stmt->execute()) {
121
+    if (!$delete_stmt->execute()) {
122 122
       throw new \Exception("Unable to delete existing stats rows.");
123 123
     }
124 124
   }
125 125
 
126
-  private function _LoadDraftSpecificStats(Draft $draft, DraftStats &$stats) {
126
+  private function _LoadDraftSpecificStats(Draft $draft, DraftStats & $stats) {
127 127
     $start_time = new \DateTime($draft->draft_start_time, new \DateTimeZone("UTC"));
128 128
     $end_time = new \DateTime($draft->draft_end_time, new \DateTimeZone("UTC"));
129 129
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     $stats->drafting_time_seconds = (int)($end_seconds - $start_seconds);
134 134
   }
135 135
 
136
-  private function _LoadLongestAveragePick($draft_id, DraftStats &$stats) {
136
+  private function _LoadLongestAveragePick($draft_id, DraftStats & $stats) {
137 137
     $stmt = $this->app['db']->prepare("SELECT p.pick_duration, m.manager_name, avg(pick_duration) as pick_average
138 138
     FROM players p
139 139
     LEFT OUTER JOIN managers m
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     $stats->longest_avg_pick_seconds = (int)$row['pick_average'];
154 154
   }
155 155
 
156
-  private function _LoadShortestAveragePick($draft_id, DraftStats &$stats) {
156
+  private function _LoadShortestAveragePick($draft_id, DraftStats & $stats) {
157 157
     $stmt = $this->app['db']->prepare("SELECT p.pick_duration, m.manager_name, avg(pick_duration) as pick_average
158 158
     FROM players p
159 159
     LEFT OUTER JOIN managers m
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
     $row = $stmt->fetch();
171 171
 
172 172
     $stats->shortest_avg_pick_manager_name = $row['manager_name'];
173
-    $stats->shortest_avg_pick_seconds = (int) $row['pick_average'];
173
+    $stats->shortest_avg_pick_seconds = (int)$row['pick_average'];
174 174
   }
175 175
 
176
-  private function _LoadSlowestPick($draft_id, DraftStats &$stats) {
176
+  private function _LoadSlowestPick($draft_id, DraftStats & $stats) {
177 177
     $stmt = $this->app['db']->prepare("SELECT p.pick_duration, p.player_pick, m.manager_name, max(pick_duration) as pick_max
178 178
     FROM players p
179 179
     LEFT OUTER JOIN managers m
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
     $row = $stmt->fetch();
191 191
 
192 192
     $stats->longest_single_pick_manager_name = $row['manager_name'];
193
-    $stats->longest_single_pick_seconds = (int) $row['pick_max'];
193
+    $stats->longest_single_pick_seconds = (int)$row['pick_max'];
194 194
   }
195 195
 
196
-  private function _LoadFastestPick($draft_id, DraftStats &$stats) {
196
+  private function _LoadFastestPick($draft_id, DraftStats & $stats) {
197 197
     $stmt = $this->app['db']->prepare("SELECT p.pick_duration, p.player_pick, m.manager_name, min(pick_duration) as pick_min
198 198
     FROM players p
199 199
     LEFT OUTER JOIN managers m
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
     $row = $stmt->fetch();
211 211
 
212 212
     $stats->shortest_single_pick_manager_name = $row['manager_name'];
213
-    $stats->shortest_single_pick_seconds = (int) $row['pick_min'];
213
+    $stats->shortest_single_pick_seconds = (int)$row['pick_min'];
214 214
   }
215 215
 
216
-  private function _LoadAveragePickTime($draft_id, DraftStats &$stats) {
216
+  private function _LoadAveragePickTime($draft_id, DraftStats & $stats) {
217 217
     $stmt = $this->app['db']->prepare("SELECT avg(pick_duration) as pick_average
218 218
     FROM players p
219 219
     WHERE p.draft_id = ?
@@ -225,10 +225,10 @@  discard block
 block discarded – undo
225 225
 
226 226
     $row = $stmt->fetch();
227 227
 
228
-    $stats->average_pick_seconds = (int) $row['pick_average'];
228
+    $stats->average_pick_seconds = (int)$row['pick_average'];
229 229
   }
230 230
 
231
-  private function _LoadRoundTimes(Draft $draft, DraftStats &$stats) {
231
+  private function _LoadRoundTimes(Draft $draft, DraftStats & $stats) {
232 232
     $stmt = $this->app['db']->prepare("SELECT DISTINCT p.player_round, sum( p.pick_duration ) AS round_time
233 233
     FROM players p
234 234
     WHERE p.draft_id = ?
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 
244 244
     $row = $stmt->fetch();
245 245
 
246
-    $stats->longest_round = (int) $row['player_round'];
247
-    $stats->longest_round_seconds = (int) $row['round_time'];
246
+    $stats->longest_round = (int)$row['player_round'];
247
+    $stats->longest_round_seconds = (int)$row['round_time'];
248 248
 
249 249
     //Stupid that I can't just re-use the above statement. All that changes is DESC to ASC. Stupid.
250 250
     $stmt = $this->app['db']->prepare("SELECT DISTINCT p.player_round, sum( p.pick_duration ) AS round_time
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 
262 262
     $row = $stmt->fetch();
263 263
 
264
-    $stats->shortest_round = (int) $row['player_round'];
265
-    $stats->shortest_round_seconds = (int) $row['round_time'];
264
+    $stats->shortest_round = (int)$row['player_round'];
265
+    $stats->shortest_round_seconds = (int)$row['round_time'];
266 266
 
267 267
     $stmt = $this->app['db']->prepare("SELECT p.player_round, sum( p.pick_duration ) / ? AS avg_round_time
268 268
     FROM players p
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
 
280 280
     $row = $stmt->fetch();
281 281
 
282
-    $stats->average_round_seconds = (int) $row['avg_round_time'];
282
+    $stats->average_round_seconds = (int)$row['avg_round_time'];
283 283
   }
284 284
 
285
-  private function _LoadTeamSuperlatives($draft_id, DraftStats &$stats, $teams) {
285
+  private function _LoadTeamSuperlatives($draft_id, DraftStats & $stats, $teams) {
286 286
     $stmt = $this->app['db']->prepare("SELECT DISTINCT p.team, count(team) as team_occurences
287 287
     FROM players p
288 288
     WHERE p.draft_id = ?
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     $row = $stmt->fetch();
299 299
 
300 300
     $stats->most_drafted_team = isset($row['team']) ? $teams[$row['team']] : "";
301
-    $stats->most_drafted_team_count = (int) $row['team_occurences'];
301
+    $stats->most_drafted_team_count = (int)$row['team_occurences'];
302 302
 
303 303
     $stmt = $this->app['db']->prepare("SELECT DISTINCT p.team, count(team) as team_occurences
304 304
     FROM players p
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
     $row = $stmt->fetch();
316 316
 
317 317
     $stats->least_drafted_team = isset($row['team']) ? $teams[$row['team']] : "";
318
-    $stats->least_drafted_team_count = (int) $row['team_occurences'];
318
+    $stats->least_drafted_team_count = (int)$row['team_occurences'];
319 319
   }
320 320
 
321
-  private function _LoadPositionSuperlatives($draft_id, DraftStats &$stats, $positions) {
321
+  private function _LoadPositionSuperlatives($draft_id, DraftStats & $stats, $positions) {
322 322
     $stmt = $this->app['db']->prepare("SELECT DISTINCT p.position, count(position) as position_occurences
323 323
     FROM players p
324 324
     WHERE p.draft_id = ?
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     $row = $stmt->fetch();
335 335
 
336 336
     $stats->most_drafted_position = isset($row['position']) ? $positions[$row['position']] : "";
337
-    $stats->most_drafted_position_count = (int) $row['position_occurences'];
337
+    $stats->most_drafted_position_count = (int)$row['position_occurences'];
338 338
 
339 339
     $stmt = $this->app['db']->prepare("SELECT DISTINCT p.position, count(position) as position_occurences
340 340
     FROM players p
@@ -351,6 +351,6 @@  discard block
 block discarded – undo
351 351
     $row = $stmt->fetch();
352 352
 
353 353
     $stats->least_drafted_position = isset($row['position']) ? $positions[$row['position']] : "";
354
-    $stats->least_drafted_position_count = (int) $row['position_occurences'];
354
+    $stats->least_drafted_position_count = (int)$row['position_occurences'];
355 355
   }
356 356
 }
357 357
\ No newline at end of file
Please login to merge, or discard this patch.
api/Domain/Repositories/DepthChartPositionRepository.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
   public function LoadAll($draft_id) {
18 18
     $positions = array();
19 19
     
20
-    $stmt = $this->app['db']->prepare("SELECT d.* ".
20
+    $stmt = $this->app['db']->prepare("SELECT d.* " .
21 21
             "FROM depth_chart_positions d " .
22 22
             "WHERE d.draft_id = ? " .
23 23
             "ORDER BY d.display_order");
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
     
27 27
     $stmt->setFetchMode(\PDO::FETCH_CLASS, '\PhpDraft\Domain\Entities\DepthChartPosition');
28 28
     
29
-    if(!$stmt->execute()) {
29
+    if (!$stmt->execute()) {
30 30
       throw new \Exception("Unable to load updated positions.");
31 31
     }
32 32
     
33
-    while($position = $stmt->fetch()) {
33
+    while ($position = $stmt->fetch()) {
34 34
       $positions[] = $position;
35 35
     }
36 36
     
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     $delete_stmt = $this->app['db']->prepare("DELETE FROM depth_chart_positions WHERE draft_id = ?");
67 67
     $delete_stmt->bindParam(1, $draft_id);
68 68
 
69
-    if(!$delete_stmt->execute()) {
69
+    if (!$delete_stmt->execute()) {
70 70
       throw new \Exception("Unable to delete existing depth chart positions.");
71 71
     }
72 72
   }
Please login to merge, or discard this patch.
api/Domain/Repositories/ManagerRepository.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 
36 36
     $managers_stmt->bindParam(1, $draft_id);
37 37
 
38
-    if(!$managers_stmt->execute()) {
38
+    if (!$managers_stmt->execute()) {
39 39
       throw new \Exception("Unable to load managers for draft #$draft_id");
40 40
     }
41 41
 
42
-    while($manager = $managers_stmt->fetch()) {
42
+    while ($manager = $managers_stmt->fetch()) {
43 43
       $managers[] = $manager;
44 44
     }
45 45
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
   public function GetManagersByDraftOrder($draft_id, $descending = false) {
50 50
     $managers = array();
51 51
 
52
-    if($descending) {
52
+    if ($descending) {
53 53
       $managers_stmt = $this->app['db']->prepare("SELECT * FROM managers WHERE draft_id = ? ORDER BY draft_order DESC");
54 54
     } else {
55 55
       $managers_stmt = $this->app['db']->prepare("SELECT * FROM managers WHERE draft_id = ? ORDER BY draft_order");  
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 
60 60
     $managers_stmt->setFetchMode(\PDO::FETCH_CLASS, '\PhpDraft\Domain\Entities\Manager');
61 61
 
62
-    if(!$managers_stmt->execute()) {
62
+    if (!$managers_stmt->execute()) {
63 63
       throw new \Exception("Unable to load managers for draft #$draft_id");
64 64
     }
65 65
 
66
-    while($manager = $managers_stmt->fetch()) {
66
+    while ($manager = $managers_stmt->fetch()) {
67 67
       $managers[] = $manager;
68 68
     }
69 69
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     $manager_stmt = $this->app['db']->prepare("SELECT manager_name FROM managers WHERE draft_id = ?");
76 76
     $manager_stmt->bindParam(1, $draft_id);
77 77
 
78
-    if(!$manager_stmt->execute()) {
78
+    if (!$manager_stmt->execute()) {
79 79
       throw new \Exception("Draft id '%s' is invalid", $draft_id);
80 80
     }
81 81
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     $manager_stmt = $this->app['db']->prepare("SELECT COUNT(manager_id) FROM managers WHERE draft_id = ?");
87 87
     $manager_stmt->bindParam(1, $draft_id);
88 88
 
89
-    if(!$manager_stmt->execute()) {
89
+    if (!$manager_stmt->execute()) {
90 90
       throw new \Exception("Unable to get number of managers for draft #$draft_id");
91 91
     }
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
   }
95 95
 
96 96
   public function NameIsUnique($name, $draft_id, $id = null) {
97
-    if(!empty($id)) {
97
+    if (!empty($id)) {
98 98
       $name_stmt = $this->app['db']->prepare("SELECT manager_name FROM managers WHERE manager_name LIKE ? AND draft_id = ? AND manager_id <> ?");
99 99
       $name_stmt->bindParam(1, $name);
100 100
       $name_stmt->bindParam(2, $draft_id);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
       $name_stmt->bindParam(2, $draft_id);
106 106
     }
107 107
 
108
-    if(!$name_stmt->execute()) {
108
+    if (!$name_stmt->execute()) {
109 109
       throw new \Exception("Manager name '$name' is invalid");
110 110
     }
111 111
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     $exists_stmt->bindParam(1, $id);
118 118
     $exists_stmt->bindParam(2, $draft_id);
119 119
 
120
-    if(!$exists_stmt->execute()) {
120
+    if (!$exists_stmt->execute()) {
121 121
       throw new \Exception("Manager ID $id is invalid");
122 122
     }
123 123
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
       throw new \Exception("Unable to create new manager: " . $this->app['db']->errorInfo());
137 137
     }
138 138
 
139
-    $manager->manager_id = (int) $this->app['db']->lastInsertId();
139
+    $manager->manager_id = (int)$this->app['db']->lastInsertId();
140 140
 
141 141
     return $manager;
142 142
   }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     $newDraftOrder = $this->_GetLowestDraftorder($draft_id) + 1;
149 149
     $newManagers = array();
150 150
 
151
-    foreach($managersArray as $newManager) {
151
+    foreach ($managersArray as $newManager) {
152 152
       $save_stmt->bindValue(':draft_id', $newManager->draft_id);
153 153
       $save_stmt->bindValue(':manager_name', $newManager->manager_name);
154 154
       $save_stmt->bindValue(':draft_order', $newDraftOrder++);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     $update_stmt->bindParam(1, $manager->manager_name);
170 170
     $update_stmt->bindParam(2, $manager->manager_id);
171 171
 
172
-    if(!$update_stmt->execute()) {
172
+    if (!$update_stmt->execute()) {
173 173
       throw new \Exception("Unable to update manager #$manager->manager_id");
174 174
     }
175 175
 
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 
182 182
     $newDraftOrder = 1;
183 183
 
184
-    foreach($managersIdArray as $manager_id) {
184
+    foreach ($managersIdArray as $manager_id) {
185 185
       $reorder_stmt->bindValue(':draft_order', $newDraftOrder++);
186 186
       $reorder_stmt->bindValue(':manager_id', $manager_id);
187 187
 
188
-      if(!$reorder_stmt->execute()) {
188
+      if (!$reorder_stmt->execute()) {
189 189
         throw new \Exception("Unable to update manager order for manager #$manager_id");
190 190
       }
191 191
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     $delete_stmt = $this->app['db']->prepare("DELETE FROM managers WHERE manager_id = ?");
198 198
     $delete_stmt->bindParam(1, $manager_id);
199 199
 
200
-    if(!$delete_stmt->execute()) {
200
+    if (!$delete_stmt->execute()) {
201 201
       throw new \Exception("Unable to delete manager $manager_id.");
202 202
     }
203 203
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     $delete_stmt = $this->app['db']->prepare("DELETE FROM managers WHERE draft_id = ?");
209 209
     $delete_stmt->bindParam(1, $draft_id);
210 210
 
211
-    if(!$delete_stmt->execute()) {
211
+    if (!$delete_stmt->execute()) {
212 212
       throw new \Exception("Unable to delete managers for draft $draft_id.");
213 213
     }
214 214
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,11 +18,13 @@
 block discarded – undo
18 18
     $load_stmt->setFetchMode(\PDO::FETCH_INTO, $manager);
19 19
     $load_stmt->bindParam(1, $id);
20 20
 
21
-    if (!$load_stmt->execute())
22
-      throw new \Exception(sprintf('Manager "%s" does not exist.', $manager));
21
+    if (!$load_stmt->execute()) {
22
+          throw new \Exception(sprintf('Manager "%s" does not exist.', $manager));
23
+    }
23 24
 
24
-    if (!$load_stmt->fetch())
25
-      throw new \Exception(sprintf('Manager "%s" does not exist.', $id));
25
+    if (!$load_stmt->fetch()) {
26
+          throw new \Exception(sprintf('Manager "%s" does not exist.', $id));
27
+    }
26 28
 
27 29
     return $manager;
28 30
   }
Please login to merge, or discard this patch.