@@ -5,7 +5,7 @@ |
||
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | $app->register(new Silex\Provider\DoctrineServiceProvider(), array( |
| 8 | - 'db.options' => array ( |
|
| 8 | + 'db.options' => array( |
|
| 9 | 9 | 'driver' => DB_DRIVER, |
| 10 | 10 | 'host' => DB_HOST, |
| 11 | 11 | 'dbname' => DB_NAME, |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | |
| 107 | 107 | $app->get('/draft/{draft_id}/picks', 'pick.controller:GetAll')->before($draftViewable)->before($draftInProgressOrCompleted); |
| 108 | 108 | $app->get('/draft/{draft_id}/picks/updated', 'pick.controller:GetUpdated')->before($draftViewable)->before($draftInProgressOrCompleted); |
| 109 | -$app->put('/draft/{draft_id}/pick/{pick_id}/depth_chart/{position_id}', 'pick.controller:UpdateDepthChart')->before($draftViewable)->before($draftInProgressOrCompletedTenMinutes);#Give a ten minute grace period to allow edits right at the end |
|
| 109 | +$app->put('/draft/{draft_id}/pick/{pick_id}/depth_chart/{position_id}', 'pick.controller:UpdateDepthChart')->before($draftViewable)->before($draftInProgressOrCompletedTenMinutes); #Give a ten minute grace period to allow edits right at the end |
|
| 110 | 110 | $app->get('/draft/{draft_id}/picks/last', 'pick.controller:GetLast')->before($draftViewable)->before($draftInProgressOrCompleted); |
| 111 | 111 | $app->get('/draft/{draft_id}/picks/next', 'pick.controller:GetNext')->before($draftViewable)->before($draftInProgressOrCompleted); |
| 112 | 112 | $app->get('/draft/{draft_id}/manager/{manager_id}/picks/all', 'pick.controller:GetAllManagerPicks')->before($draftViewable)->before($draftInProgressOrCompleted); |
@@ -6,42 +6,42 @@ |
||
| 6 | 6 | |
| 7 | 7 | //Repositories |
| 8 | 8 | //Repositories are classes that are responsible for loading and saving data. |
| 9 | -$app['phpdraft.LoginUserRepository'] = function () use ($app) { |
|
| 9 | +$app['phpdraft.LoginUserRepository'] = function() use ($app) { |
|
| 10 | 10 | return new \PhpDraft\Domain\Repositories\LoginUserRepository($app); |
| 11 | 11 | }; |
| 12 | 12 | |
| 13 | -$app['phpdraft.DraftRepository'] = function () use ($app) { |
|
| 13 | +$app['phpdraft.DraftRepository'] = function() use ($app) { |
|
| 14 | 14 | return new \PhpDraft\Domain\Repositories\DraftRepository($app); |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | -$app['phpdraft.ManagerRepository'] = function () use ($app) { |
|
| 17 | +$app['phpdraft.ManagerRepository'] = function() use ($app) { |
|
| 18 | 18 | return new \PhpDraft\Domain\Repositories\ManagerRepository($app); |
| 19 | 19 | }; |
| 20 | 20 | |
| 21 | -$app['phpdraft.PickRepository'] = function () use ($app) { |
|
| 21 | +$app['phpdraft.PickRepository'] = function() use ($app) { |
|
| 22 | 22 | return new \PhpDraft\Domain\Repositories\PickRepository($app); |
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | -$app['phpdraft.TradeRepository'] = function () use ($app) { |
|
| 25 | +$app['phpdraft.TradeRepository'] = function() use ($app) { |
|
| 26 | 26 | return new \PhpDraft\Domain\Repositories\TradeRepository($app); |
| 27 | 27 | }; |
| 28 | 28 | |
| 29 | -$app['phpdraft.DraftDataRepository'] = function () use ($app) { |
|
| 29 | +$app['phpdraft.DraftDataRepository'] = function() use ($app) { |
|
| 30 | 30 | return new \PhpDraft\Domain\Repositories\DraftDataRepository($app); |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | -$app['phpdraft.RoundTimeRepository'] = function () use ($app) { |
|
| 33 | +$app['phpdraft.RoundTimeRepository'] = function() use ($app) { |
|
| 34 | 34 | return new \PhpDraft\Domain\Repositories\RoundTimeRepository($app); |
| 35 | 35 | }; |
| 36 | 36 | |
| 37 | -$app['phpdraft.ProPlayerRepository'] = function () use ($app) { |
|
| 37 | +$app['phpdraft.ProPlayerRepository'] = function() use ($app) { |
|
| 38 | 38 | return new \PhpDraft\Domain\Repositories\ProPlayerRepository($app); |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | -$app['phpdraft.DraftStatsRepository'] = function () use ($app) { |
|
| 41 | +$app['phpdraft.DraftStatsRepository'] = function() use ($app) { |
|
| 42 | 42 | return new \PhpDraft\Domain\Repositories\DraftStatsRepository($app); |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | -$app['phpdraft.DepthChartPositionRepository'] = function () use ($app) { |
|
| 45 | +$app['phpdraft.DepthChartPositionRepository'] = function() use ($app) { |
|
| 46 | 46 | return new \PhpDraft\Domain\Repositories\DepthChartPositionRepository($app); |
| 47 | 47 | }; |
| 48 | 48 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | throw new Exception('Invalid application setup.'); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -$app['users'] = function () use ($app) { |
|
| 12 | +$app['users'] = function() use ($app) { |
|
| 13 | 13 | return new UserProvider($app); |
| 14 | 14 | }; |
| 15 | 15 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | $array = array('success' => false); |
| 20 | 20 | |
| 21 | - if($authException) { |
|
| 21 | + if ($authException) { |
|
| 22 | 22 | $array['error'] = $authException; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | }; |
| 17 | 17 | }); |
| 18 | 18 | |
| 19 | -$app['phpdraft.EmailValidator'] = $app->factory(function () { |
|
| 19 | +$app['phpdraft.EmailValidator'] = $app->factory(function() { |
|
| 20 | 20 | return new EmailValidator(); |
| 21 | 21 | }); |
| 22 | 22 | |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | throw new Exception('Invalid application setup.'); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if($app['debug'] == true) { |
|
| 7 | +if ($app['debug'] == true) { |
|
| 8 | 8 | $app->register(new Silex\Provider\MonologServiceProvider(), array( |
| 9 | - 'monolog.logfile' => __DIR__.'/logs/' . LOGFILE_NAME, |
|
| 9 | + 'monolog.logfile' => __DIR__ . '/logs/' . LOGFILE_NAME, |
|
| 10 | 10 | )); |
| 11 | 11 | } |
| 12 | 12 | \ No newline at end of file |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | throw new Exception('Invalid application setup.'); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -$app->error(function (\Exception $e, $code) use($app) { |
|
| 14 | +$app->error(function(\Exception $e, $code) use($app) { |
|
| 15 | 15 | return $app->json(array("error" => $e->getMessage()), Response::HTTP_INTERNAL_SERVER_ERROR); |
| 16 | 16 | }); |
| 17 | 17 | |
| 18 | 18 | //If we get application/json, decode the data so controllers can use it |
| 19 | -$app->before(function (Request $request) { |
|
| 19 | +$app->before(function(Request $request) { |
|
| 20 | 20 | if (0 === strpos($request->headers->get('Content-Type'), 'application/json')) { |
| 21 | 21 | $data = json_decode($request->getContent(), true); |
| 22 | 22 | $request->request->replace(is_array($data) ? $data : array()); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $viewable = $app['phpdraft.DraftValidator']->IsDraftViewableForUser($draft_id, $request); |
| 31 | 31 | |
| 32 | - if(!$viewable) { |
|
| 32 | + if (!$viewable) { |
|
| 33 | 33 | $response = new PhpDraftResponse(false, array()); |
| 34 | 34 | $response->errors[] = "Draft marked as private."; |
| 35 | 35 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $setting_up = $app['phpdraft.DraftValidator']->IsDraftSettingUpOrInProgress($draft); |
| 45 | 45 | |
| 46 | - if(!$setting_up->success) { |
|
| 46 | + if (!$setting_up->success) { |
|
| 47 | 47 | return $app->json(array($setting_up), $setting_up->responseType()); |
| 48 | 48 | } |
| 49 | 49 | }; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $in_progress = $app['phpdraft.DraftValidator']->IsDraftInProgress($draft); |
| 56 | 56 | |
| 57 | - if(!$in_progress->success) { |
|
| 57 | + if (!$in_progress->success) { |
|
| 58 | 58 | return $app->json(array($in_progress), $in_progress->responseType()); |
| 59 | 59 | } |
| 60 | 60 | }; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $in_progress = $app['phpdraft.DraftValidator']->IsDraftInProgressOrComplete($draft); |
| 67 | 67 | |
| 68 | - if(!$in_progress->success) { |
|
| 68 | + if (!$in_progress->success) { |
|
| 69 | 69 | return $app->json(array($in_progress), $in_progress->responseType()); |
| 70 | 70 | } |
| 71 | 71 | }; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $grace_period = $app['phpdraft.DraftValidator']->IsDraftInProgressOrCompletedInLessThanTen($draft); |
| 79 | 79 | |
| 80 | - if(!$grace_period->success) { |
|
| 80 | + if (!$grace_period->success) { |
|
| 81 | 81 | return $app->json(array($grace_period), $grace_period->responseType()); |
| 82 | 82 | } |
| 83 | 83 | }; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $completed = $app['phpdraft.DraftValidator']->IsDraftComplete($draft); |
| 90 | 90 | |
| 91 | - if(!$completed->success) { |
|
| 91 | + if (!$completed->success) { |
|
| 92 | 92 | return $app->json(array($completed), $completed->responseType()); |
| 93 | 93 | } |
| 94 | 94 | }; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $editable = $app['phpdraft.DraftValidator']->IsDraftEditableForUser($draft, $current_user); |
| 103 | 103 | |
| 104 | - if(!$editable) { |
|
| 104 | + if (!$editable) { |
|
| 105 | 105 | $response = new PhpDraft\Domain\Models\PhpDraftResponse(false, array()); |
| 106 | 106 | $response->errors[] = "You do not have permission to this draft."; |
| 107 | 107 | |
@@ -19,23 +19,23 @@ |
||
| 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 | } |