1 | <?php |
||
7 | class Jetpack_Search_Debug_Bar extends Debug_Bar_Panel { |
||
8 | /** |
||
9 | * Holds singleton instance |
||
10 | * |
||
11 | * @var Jetpack_Search_Debug_Bar |
||
12 | */ |
||
13 | protected static $instance = null; |
||
14 | |||
15 | /** |
||
16 | * The title to use in the debug bar navigation |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | public $title; |
||
21 | |||
22 | /** |
||
23 | * Constructor |
||
24 | */ |
||
25 | public function __construct() { |
||
30 | |||
31 | /** |
||
32 | * Returns the singleton instance of Jetpack_Search_Debug_Bar |
||
33 | * |
||
34 | * @return Jetpack_Search_Debug_Bar |
||
35 | */ |
||
36 | public static function instance() { |
||
42 | |||
43 | /** |
||
44 | * Enqueues styles for our panel in the debug bar |
||
45 | * |
||
46 | * @return void |
||
47 | */ |
||
48 | public function enqueue_scripts() { |
||
59 | |||
60 | /** |
||
61 | * Should the Jetpack Search Debug Bar show? |
||
62 | * |
||
63 | * Since we've previously done a check for the search module being activated, let's just return true. |
||
64 | * Later on, we can update this to only show when `is_search()` is true. |
||
65 | * |
||
66 | * @return boolean |
||
67 | */ |
||
68 | public function is_visible() { |
||
71 | |||
72 | /** |
||
73 | * Renders the panel content |
||
74 | * |
||
75 | * @return void |
||
76 | */ |
||
77 | public function render() { |
||
138 | |||
139 | /** |
||
140 | * Responsible for rendering the HTML necessary for the JSON toggle |
||
141 | * |
||
142 | * @param array $value The resonse from the API as an array. |
||
143 | * @return void |
||
144 | */ |
||
145 | public function render_json_toggle( $value ) { |
||
154 | } |
||
155 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.