| Conditions | 6 |
| Paths | 32 |
| Total Lines | 24 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function Search(Application $app, Request $request) { |
||
| 13 | $league = $request->get('league'); |
||
| 14 | |||
| 15 | $searchTerm = $request->get('searchTerm'); |
||
| 16 | |||
| 17 | $first = $request->get('first'); |
||
| 18 | $last = $request->get('last'); |
||
| 19 | $team = $request->get('team'); |
||
| 20 | $position = $request->get('position'); |
||
| 21 | |||
| 22 | $first = strlen($first) == 0 ? "NA" : $first; |
||
| 23 | $last = strlen($last) == 0 ? "NA" : $last; |
||
| 24 | $team = strlen($team) == 0 ? "NA" : $team; |
||
| 25 | $position = strlen($position) == 0 ? "NA" : $position; |
||
| 26 | |||
| 27 | $response = new PhpDraftResponse(); |
||
|
|
|||
| 28 | |||
| 29 | if (count($searchTerm) > 0) { |
||
| 30 | $response = $app['phpdraft.ProPlayerService']->SearchPlayers($league, $searchTerm); |
||
| 31 | } else { |
||
| 32 | $response = $app['phpdraft.ProPlayerService']->SearchPlayersManual($league, $first, $last, $team, $position); |
||
| 33 | } |
||
| 34 | |||
| 35 | return $app->json($response, $response->responseType()); |
||
| 36 | } |
||
| 37 | } |