| Conditions | 4 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function GetManagerDepthChart(Application $app, Request $request) { |
||
| 17 | $draft_id = (int)$request->get('draft_id'); |
||
| 18 | $manager_id = (int)$request->get('manager_id'); |
||
| 19 | |||
| 20 | if (empty($draft_id) || $draft_id == 0) { |
||
| 21 | throw new \Exception("Unable to load draft."); |
||
| 22 | } |
||
| 23 | |||
| 24 | $draft = $app['phpdraft.DraftRepository']->Load($draft_id); |
||
| 25 | |||
| 26 | if (!$draft->using_depth_charts) { |
||
| 27 | $response = $app['phpdraft.ResponseFactory'](false, array("Draft is not configured to use depth charts.")); |
||
| 28 | return $app->json($response, $response->responseType()); |
||
| 29 | } |
||
| 30 | |||
| 31 | $response = $app['phpdraft.DepthChartPositionService']->GetManagerDepthChart($draft, $manager_id); |
||
| 32 | |||
| 33 | return $app->json($response, $response->responseType()); |
||
| 34 | } |
||
| 35 | } |