Completed
Push — master ( eb2586...ec2395 )
by Sherif
01:59
created

ReportController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getReport() 0 4 1
1
<?php
2
3
namespace App\Modules\Reporting\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use App\Modules\Core\BaseClasses\BaseApiController;
7
use App\Modules\Reporting\Repositories\ReportRepository;
8
use App\Modules\Core\Utl\CoreConfig;
9
10
class ReportController extends BaseApiController
11
{
12
    /**
13
     * List of all route actions that the base api controller
14
     * will skip permissions check for them.
15
     * @var array
16
     */
17
    protected $skipPermissionCheck = ['getReport'];
18
19
    /**
20
     * Init new object.
21
     *
22
     * @param   ReportRepository $repo
23
     * @param   CoreConfig       $config
24
     * @return  void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
25
     */
26
    public function __construct(ReportRepository $repo, CoreConfig $config)
27
    {
28
        parent::__construct($repo, $config, 'App\Modules\Reporting\Http\Resources\Report');
29
    }
30
31
    /**
32
     * Render the given report name with the given conditions.
33
     *
34
     * @param Request $request
35
     * @param  string $reportName Name of the requested report
36
     * @return \Illuminate\Http\Response
37
     */
38
    public function getReport(Request $request, $reportName)
39
    {
40
        return \Response::json($this->repo->getReport($reportName, $request->all(), $request->query('perPage')), 200);
41
    }
42
}
43