DraftStatsController::Create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
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 DraftStatsController
12
{
13
  public function GetDrafts(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 GetDrafts(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
    $drafts = $app['phpdraft.DraftRepository']->GetAllCompletedDrafts();
15
16
    return $app->json($drafts);
17
  }
18
19
  public function Create(Application $app, Request $request) {
20
    $draft_id = $request->get('draft_id');
21
    $draft = $app['phpdraft.DraftRepository']->Load($draft_id);
22
23
    $stats = $app['phpdraft.DraftStatsRepository']->CalculateDraftStatistics($draft);
24
25
    return $app->json($stats);
26
  }
27
}