ProPlayerController::GetSports()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace PhpDraft\Controllers\Admin;
4
5
use \Silex\Application;
6
use Symfony\Component\HttpFoundation\Response;
7
use Symfony\Component\HttpFoundation\Request;
8
use PhpDraft\Domain\Models\PhpDraftResponse;
9
use PhpDraft\Domain\Entities\Draft;
10
11
class ProPlayerController
12
{
13
  public function GetSports(Application $app, Request $request) {
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

13
  public function GetSports(Application $app, /** @scrutinizer ignore-unused */ Request $request) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
    $sports = $app['phpdraft.DraftDataRepository']->GetSports();
15
16
    return $app->json($sports, Response::HTTP_OK);
17
  }
18
19
  public function Upload(Application $app, Request $request) {
20
    $sport = $request->get('sport');
21
    $file = $request->files->get('file');
22
23
    $validity = $app['phpdraft.ProPlayerValidator']->IsUploadSportValid($sport, $file);
24
25
    if (!$validity->success) {
26
      return $app->json($validity, $validity->responseType());
27
    }
28
29
    $response = $app['phpdraft.ProPlayerService']->Upload($sport, $file);
30
31
    return $app->json($response, $response->responseType());
32
  }
33
}