Passed
Push — master ( 0e4958...46624d )
by Matthew
03:42 queued 01:13
created
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/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.
api/Controllers/Commish/DepthChartPositionController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
     $validity = $app['phpdraft.DepthChartPositionValidator']->IsDraftSportValid($draft_sport);
16 16
 
17
-    if(!$validity->success) {
17
+    if (!$validity->success) {
18 18
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
19 19
     }
20 20
 
Please login to merge, or discard this patch.
api/Controllers/Commish/IndexController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     //Leaving this here as we also grab roles below, but LoginUserService->GetCurrentUser() will fetch user via this method too:
15 15
     $token = $app['security']->getToken();
16 16
 
17
-    if($token !== null) {
17
+    if ($token !== null) {
18 18
       $usr = $token->getUser();
19 19
 
20 20
       $isAuthenticated = true;
Please login to merge, or discard this patch.
api/Controllers/Commish/ManagerController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     $validity = $app['phpdraft.ManagerValidator']->IsManagerValidForCreate($draftId, $manager);
28 28
 
29
-    if(!$validity->success) {
29
+    if (!$validity->success) {
30 30
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
31 31
     }
32 32
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     $managersJson = $request->get('managers');
42 42
     $newManagers = array();
43 43
 
44
-    foreach($managersJson as $managerRequest) {
44
+    foreach ($managersJson as $managerRequest) {
45 45
       $newManager = new Manager();
46 46
       $newManager->draft_id = $draftId;
47 47
       $newManager->manager_name = $managerRequest['manager_name'];
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     $validity = $app['phpdraft.ManagerValidator']->AreManagersValidForCreate($draftId, $newManagers);
53 53
 
54
-    if(!$validity->success) {
54
+    if (!$validity->success) {
55 55
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
56 56
     }
57 57
 
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
     $managersIdJson = $request->get('ordered_manager_ids');
67 67
     $managerIds = array();
68 68
 
69
-    foreach($managersIdJson as $managerId) {
69
+    foreach ($managersIdJson as $managerId) {
70 70
       $managerIds[] = (int)$managerId;
71 71
     }
72 72
 
73 73
     $validity = $app['phpdraft.ManagerValidator']->AreManagerIdsValidForOrdering($draftId, $managerIds);
74 74
 
75
-    if(!$validity->success) {
75
+    if (!$validity->success) {
76 76
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
77 77
     }
78 78
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     try {
89 89
       $draft = $app['phpdraft.DraftRepository']->Load($draftId);
90 90
       $manager = $app['phpdraft.ManagerRepository']->Load($managerId);
91
-    } catch(\Exception $e) {
91
+    } catch (\Exception $e) {
92 92
       $response = new PhpDraftResponse(false, array());
93 93
       $response->errors[] = "Unable to load manager #$managerId";
94 94
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
     $validity = $app['phpdraft.ManagerValidator']->IsManagerValidForUpdate($draft, $manager);
101 101
 
102
-    if(!$validity->success) {
102
+    if (!$validity->success) {
103 103
       return $app->json($validity, Response::HTTP_BAD_REQUEST);
104 104
     }
105 105
 
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 
115 115
     try {
116 116
       $manager = $app['phpdraft.ManagerRepository']->Load($managerId);
117
-    } catch(\Exception $e) {
117
+    } catch (\Exception $e) {
118 118
       $response = new PhpDraftResponse(false, array());
119 119
       $response->errors[] = "Unable to delete manager #$managerId";
120 120
 
121 121
       return $app->json($response, Response::HTTP_BAD_REQUEST);
122 122
     }
123 123
 
124
-    if($manager->draft_id != $draftId) {
124
+    if ($manager->draft_id != $draftId) {
125 125
       $response = new PhpDraftResponse(false, array());
126 126
       $response->errors[] = "Unable to delete manager #$managerId";
127 127
 
Please login to merge, or discard this patch.