DepthChartPositionController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A GetPositions() 0 14 2
1
<?php
2
namespace PhpDraft\Controllers\Commish;
3
4
use \Silex\Application;
5
use Symfony\Component\HttpFoundation\Response;
6
use Symfony\Component\HttpFoundation\Request;
7
use PhpDraft\Domain\Models\PhpDraftResponse;
8
use PhpDraft\Domain\Entities\DepthChartPosition;
9
10
class DepthChartPositionController
11
{
12
  public function GetPositions(Application $app, Request $request) {
13
    $draft_sport = $request->get('draft_sport');
14
15
    $validity = $app['phpdraft.DepthChartPositionValidator']->IsDraftSportValid($draft_sport);
16
17
    if (!$validity->success) {
18
      return $app->json($validity, Response::HTTP_BAD_REQUEST);
19
    }
20
21
    $response = $app['phpdraft.ResponseFactory'](true, array());
22
    $response->positions = array();
23
    $response->positions = $app['phpdraft.DraftDataRepository']->GetPositions($draft_sport);
24
25
    return $app->json($response);
26
  }
27
}