These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * This file contains only a single class. |
||
4 | * |
||
5 | * @file |
||
6 | * @package Tabulate |
||
7 | */ |
||
8 | |||
9 | namespace WordPress\Tabulate\Controllers; |
||
10 | |||
11 | use \WordPress\Tabulate\DB\Database; |
||
12 | use \WordPress\Tabulate\DB\Reports; |
||
13 | |||
14 | /** |
||
15 | * The reports controller is responsible for displaying reports. |
||
16 | * Editing of reports is done in the usual Tabulate fashion. |
||
17 | */ |
||
18 | class ReportsController extends ControllerBase { |
||
19 | |||
20 | /** |
||
21 | * View a report. |
||
22 | * |
||
23 | * @param string[] $args The request arguments. |
||
24 | * @return type |
||
25 | */ |
||
26 | public function index( $args ) { |
||
27 | $db = new Database( $this->wpdb ); |
||
28 | $id = isset( $args['id'] ) ? $args['id'] : Reports::DEFAULT_REPORT_ID; |
||
29 | $reports = new Reports( $db ); |
||
30 | $template = $reports->get_template( $id ); |
||
31 | $out = $template->render(); |
||
32 | if ( $template->file_extension ) { |
||
33 | $this->send_file( $template->file_extension, $template->mime_type, $out, $template->title ); |
||
0 ignored issues
–
show
|
|||
34 | } else { |
||
35 | return $out; |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: