DraftStatsController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 15
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A GetDrafts() 0 4 1
A Create() 0 7 1
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
}