diff --git a/classes/Homepage/Scotland.php b/classes/Homepage/Scotland.php index e87646dd5a..5e92dce6e9 100644 --- a/classes/Homepage/Scotland.php +++ b/classes/Homepage/Scotland.php @@ -34,7 +34,7 @@ protected function getSearchBox(array $data): \MySociety\TheyWorkForYou\Search\S protected function getEditorialContent(&$data) { $debatelist = new \SPLIST(); $item = $debatelist->display('recent_debates', ['days' => 7, 'num' => 1], 'none'); - if (isset($item['data']) && count($item['data'])) { + if (count($item['data'])) { $item = $item['data'][0]; $more_url = new \MySociety\TheyWorkForYou\Url('spdebatesfront'); $item['more_url'] = $more_url->generate(); diff --git a/classes/Homepage/UK.php b/classes/Homepage/UK.php index 38b1c61908..57709f3f7b 100644 --- a/classes/Homepage/UK.php +++ b/classes/Homepage/UK.php @@ -55,7 +55,7 @@ protected function getEditorialContent(&$data) { $item = $this->getFeaturedDebate($gid, $title, $context, $related); } else { $item = $debatelist->display('recent_debates', ['days' => 7, 'num' => 1], 'none'); - if (isset($item['data']) && count($item['data'])) { + if (count($item['data'])) { $item = $item['data'][0]; $more_url = new \MySociety\TheyWorkForYou\Url('debates'); $item['more_url'] = $more_url->generate(); diff --git a/www/includes/easyparliament/hansardlist.php b/www/includes/easyparliament/hansardlist.php index e4b0b87d1d..6a7c51fb70 100644 --- a/www/includes/easyparliament/hansardlist.php +++ b/www/includes/easyparliament/hansardlist.php @@ -2914,7 +2914,7 @@ public function _get_data_by_recent_debates($args = []) { // $args['days'] is the number of days back to look for biggest debates (1 by default). // $args['num'] is the number of links to return (1 by default). - $data = []; + $data = ['info' => [], 'data' => []]; $params = []; @@ -3010,7 +3010,7 @@ public function _get_data_by_recent_debates($args = []) { $childbody = $r['body']; $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major); - $data[] = [ + $data['data'][] = [ 'contentcount' => $contentcount, 'body' => $body, 'hdate' => $hdate, @@ -3028,13 +3028,7 @@ public function _get_data_by_recent_debates($args = []) { } - $data = [ - 'info' => [], - 'data' => $data, - ]; - return $data; - } public function _get_data_by_biggest_debates($args = []) {