| Conditions | 4 |
| Paths | 3 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace App\Modules\Reporting\Services; |
||
| 36 | public function getReport($reportName, $conditions = [], $perPage = 0, $skipPermission = false) |
||
| 37 | { |
||
| 38 | /** |
||
| 39 | * Fetch the report from db. |
||
| 40 | */ |
||
| 41 | $report = $this->repo->first(['report_name' => $reportName]); |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Check report existance and permission. |
||
| 45 | */ |
||
| 46 | if (! $report) { |
||
| 47 | \ErrorHandler::notFound('report'); |
||
| 48 | } elseif (! $skipPermission && ! $this->userService->can($report->view_name, 'report')) { |
||
| 49 | \ErrorHandler::noPermissions(); |
||
| 50 | } |
||
| 51 | |||
| 52 | return $this->repo->renderReport($report, $conditions, $perPage); |
||
| 53 | } |
||
| 54 | } |
||
| 55 |
Adding a
@returnannotation 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.