1 | <?php |
||
2 | |||
3 | namespace MySociety\TheyWorkForYou; |
||
4 | |||
5 | /** |
||
6 | * Hansard |
||
7 | */ |
||
8 | |||
9 | class Hansard extends \HANSARDLIST { |
||
10 | |||
11 | /** |
||
12 | * Search |
||
13 | * |
||
14 | * Performs a search of Hansard. |
||
15 | * |
||
16 | * @param string $searchstring The string to initialise SEARCHENGINE with. |
||
17 | * @param array $args An array of arguments to restrict search results. |
||
18 | * |
||
19 | * @return array An array of search results. |
||
20 | */ |
||
21 | |||
22 | public function search($searchstring, $args) { |
||
0 ignored issues
–
show
|
|||
23 | |||
24 | if (!defined('FRONT_END_SEARCH') || !FRONT_END_SEARCH) { |
||
25 | throw new \Exception('FRONT_END_SEARCH is not defined or is false.'); |
||
26 | } |
||
27 | |||
28 | // throw exceptions rather than emit PAGE->error |
||
29 | $args['exceptions'] = true; |
||
30 | $list = new \HANSARDLIST(); |
||
31 | return $list->display('search', $args, 'none'); |
||
0 ignored issues
–
show
The expression
return $list->display('search', $args, 'none') could also return false which is incompatible with the documented return type array . Did you maybe forget to handle an error condition?
If the returned type also contains false, it is an indicator that maybe an error condition leading to the specific return statement remains unhandled.
Loading history...
|
|||
32 | |||
33 | } |
||
34 | |||
35 | } |
||
36 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.