Passed
Push — master ( 7f1b03...1b3668 )
by Matthew
04:22
created
www/includes/easyparliament/hansardlist.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 class HANSARDLIST {
54 54
     // This will be used to cache information about speakers on this page
55 55
     // so we don't have to keep fetching the same data from the DB.
56
-    public $speakers =  [];
56
+    public $speakers = [];
57 57
     /*
58 58
     $this->speakers[ $person_id ] = array (
59 59
         "name" => $name,
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     // This will be used to cache mappings from epobject_id to gid,
68 68
     // so we don't have to continually fetch the same data in get_hansard_data().
69
-    public $epobjectid_to_gid =  [];
69
+    public $epobjectid_to_gid = [];
70 70
     /*
71 71
     $this->epobjectid_to_gid[ $epobject_id ] => $gid;
72 72
     */
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             return false;
144 144
         }
145 145
 
146
-        $validviews =  ['calendar', 'date', 'gid', 'person', 'search', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid'];
146
+        $validviews = ['calendar', 'date', 'gid', 'person', 'search', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid'];
147 147
         if (in_array($view, $validviews)) {
148 148
 
149 149
             // What function do we call for this view?
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                 [$year, $month, $date] = explode('-', $hdate);
235 235
                 $timestamp = gmmktime(0, 0, 0, $month, $date, $year);
236 236
 
237
-                $data =  [
237
+                $data = [
238 238
                     'hdate'		=> $hdate,
239 239
                     'timestamp'	=> $timestamp,
240 240
                     'listurl'	=> $URL->generate(),
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             // so get the section info above this item.
278 278
 
279 279
             // For getting hansard data.
280
-            $input =  [
280
+            $input = [
281 281
                 'amount' =>  [
282 282
                     'body' => true,
283 283
                 ],
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
         twfy_debug(get_class($this), "getting an item's subsection");
312 312
 
313 313
         // What we return.
314
-        $subsectiondata =  [];
314
+        $subsectiondata = [];
315 315
 
316 316
         if ($itemdata['htype'] == '12' || $itemdata['htype'] == '13' || $itemdata['htype'] == '14') {
317 317
             // This item is a speech or procedural, so get the
318 318
             // subsection info above this item.
319 319
 
320 320
             // For getting hansard data.
321
-            $input =  [
321
+            $input = [
322 322
                 'amount' =>  [
323 323
                     'body' => true,
324 324
                 ],
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
             $wherearr['hansard.epobject_id='] = $prev_item_id;
417 417
 
418 418
             // For getting hansard data.
419
-            $input =  [
419
+            $input = [
420 420
                 'amount' =>  [
421 421
                     'body' => true,
422 422
                     'speaker' => true,
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                 if ($itemdata['htype'] == '10' || $itemdata['htype'] == '11') {
433 433
                     // Linking to the prev (sub)section.
434 434
                     $thing = $hansardmajors[$this->major]['singular'];
435
-                    $nextprevdata['prev'] =  [
435
+                    $nextprevdata['prev'] = [
436 436
                         'body'		=> sprintf(gettext("Previous %s"), $thing),
437 437
                         'url'		=> $prevdata[0]['listurl'],
438 438
                         'title'		=> $prevdata[0]['body'],
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
                     } else {
446 446
                         $title = '';
447 447
                     }
448
-                    $nextprevdata['prev'] =  [
448
+                    $nextprevdata['prev'] = [
449 449
                         'body'		=> gettext('Previous speaker'),
450 450
                         'url'		=> $prevdata[0]['commentsurl'],
451 451
                         'title'		=> $title,
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
             $wherearr['hansard.epobject_id='] = $next_item_id;
462 462
 
463 463
             // For getting hansard data.
464
-            $input =  [
464
+            $input = [
465 465
                 'amount' =>  [
466 466
                     'body' => true,
467 467
                     'speaker' => true,
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
                 if ($itemdata['htype'] == '10' || $itemdata['htype'] == '11') {
477 477
                     // Linking to the next (sub)section.
478 478
                     $thing = $hansardmajors[$this->major]['singular'];
479
-                    $nextprevdata['next'] =  [
479
+                    $nextprevdata['next'] = [
480 480
                         'body'		=> sprintf(gettext("Next %s"), $thing),
481 481
                         'url'		=> $nextdata[0]['listurl'],
482 482
                         'title'		=> $nextdata[0]['body'],
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                     } else {
490 490
                         $title = '';
491 491
                     }
492
-                    $nextprevdata['next'] =  [
492
+                    $nextprevdata['next'] = [
493 493
                         'body'		=> gettext('Next speaker'),
494 494
                         'url'		=> $nextdata[0]['commentsurl'],
495 495
                         'title'		=> $title,
@@ -536,11 +536,11 @@  discard block
 block discarded – undo
536 536
         twfy_debug(get_class($this), "getting next/prev dates");
537 537
 
538 538
         // What we return.
539
-        $nextprevdata =  [];
539
+        $nextprevdata = [];
540 540
 
541 541
         $URL = new \MySociety\TheyWorkForYou\Url($this->listpage);
542 542
 
543
-        $looper =  ["next", "prev"];
543
+        $looper = ["next", "prev"];
544 544
 
545 545
         foreach ($looper as $n => $nextorprev) {
546 546
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
             // when displaying the first day of debates.
565 565
             if ($q && $q['hdate'] != null) {
566 566
 
567
-                $URL->insert([ 'd' => $q['hdate'] ]);
567
+                $URL->insert(['d' => $q['hdate']]);
568 568
 
569 569
                 if ($nextorprev == 'next') {
570 570
                     $body = gettext('Next day');
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 
575 575
                 $title = format_date($q['hdate'], SHORTDATEFORMAT);
576 576
 
577
-                $nextprevdata[$nextorprev] =  [
577
+                $nextprevdata[$nextorprev] = [
578 578
                     'hdate' => $q['hdate'],
579 579
                     'url' => $URL->generate(),
580 580
                     'body' => $body,
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         $thing = $hansardmajors[$this->major]['plural'];
589 589
         $URL->insert(['y' => $year]);
590 590
 
591
-        $nextprevdata['up'] =  [
591
+        $nextprevdata['up'] = [
592 592
             'body' 	=> sprintf(gettext("All of %s’s %s"), $year, $thing),
593 593
             'title'	=> '',
594 594
             'url' 	=> $URL->generate(),
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
 
647 647
         // Get all the data just for this epobject_id.
648
-        $input =  [
648
+        $input = [
649 649
             'amount' =>  [
650 650
                 'body' => true,
651 651
                 'speaker' => true,
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
             $this->check_gid_change($args['gid'], 'a', '');
687 687
 
688 688
             if (substr($args['gid'], -1) == 'L') {
689
-                $letts = ['a','b','c','d','e'];
689
+                $letts = ['a', 'b', 'c', 'd', 'e'];
690 690
                 for ($i = 0; $i < 4; $i++) {
691 691
                     $this->check_gid_change($args['gid'], $letts[$i], $letts[$i + 1]);
692 692
                 }
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
     }
731 731
 
732 732
     private function check_gid_change($gid, $from, $to) {
733
-        $input =  [
733
+        $input = [
734 734
             'amount' =>  [
735 735
                 'body' => true,
736 736
                 'speaker' => true,
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
         twfy_debug(get_class($this), "getting data by date");
759 759
 
760 760
         // Where we'll put all the data we want to render.
761
-        $data =  [];
761
+        $data = [];
762 762
 
763 763
         $date = $this->_validate_date($args);
764 764
 
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 
773 773
             // Get all the sections for this date.
774 774
             // Then for each of those we'll get the subsections and rows.
775
-            $input =  [
775
+            $input = [
776 776
                 'amount' =>  [
777 777
                     'body' => true,
778 778
                     'comment' => true,
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
                     $sectionrow = $this->_get_section($sections[$n]);
802 802
 
803 803
                     // Get the subsections within the section.
804
-                    $input =  [
804
+                    $input = [
805 805
                         'amount' =>  [
806 806
                             'body' => true,
807 807
                             'comment' => true,
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
             $major = '';
858 858
         }
859 859
 
860
-        $data =  [];
860
+        $data = [];
861 861
 
862 862
         $q = $this->db->query("SELECT DISTINCT(hdate)
863 863
                         FROM 	hansard
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 
933 933
         $speeches = [];
934 934
         foreach ($q as $row) {
935
-            $speech =  [
935
+            $speech = [
936 936
                 'subsection_id' => $row['subsection_id'],
937 937
                 'section_id' => $row['section_id'],
938 938
                 'htype' => $row['htype'],
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             // Cache parent id to speed up _get_listurl
950 950
             $this->epobjectid_to_gid[$row['subsection_id']] = fix_gid_from_db($row['gid_subsection']);
951 951
 
952
-            $url_args =  ['p' => $row['person_id']];
952
+            $url_args = ['p' => $row['person_id']];
953 953
             $speech['listurl'] = $this->_get_listurl($speech, $url_args);
954 954
             $speeches[] = $speech;
955 955
         }
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
         }
998 998
 
999 999
         // What we'll return.
1000
-        $data =  [];
1000
+        $data = [];
1001 1001
 
1002 1002
         $data['info']['s'] = $args['s'];
1003 1003
 
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
         // Log this query so we can improve them - if it wasn't a "popular
1059 1059
         // query" link
1060
-        if (! isset($args['pop']) or $args['pop'] != 1) {
1060
+        if (!isset($args['pop']) or $args['pop'] != 1) {
1061 1061
             global $SEARCHLOG;
1062 1062
             $SEARCHLOG->add(
1063 1063
                 ['query' => $searchstring,
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
                 //////////////////////////
1186 1186
                 // 2. Create the URL to link to this bit of text.
1187 1187
 
1188
-                $id_data =  [
1188
+                $id_data = [
1189 1189
                     'major'            => $itemdata['major'],
1190 1190
                     'minor'            => $itemdata['minor'],
1191 1191
                     'htype'         => $itemdata['htype'],
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
                 // We append the query onto the end of the URL as variable 's'
1198 1198
                 // so we can highlight them on the debate/wrans list page.
1199
-                $url_args =  ['s' => $searchstring];
1199
+                $url_args = ['s' => $searchstring];
1200 1200
 
1201 1201
                 $itemdata['listurl'] = $this->_get_listurl($id_data, $url_args, $encode);
1202 1202
 
@@ -1249,14 +1249,14 @@  discard block
 block discarded – undo
1249 1249
                     } else {
1250 1250
                         $listurl = '';
1251 1251
                     }
1252
-                    $itemdata['parent'] =  [
1252
+                    $itemdata['parent'] = [
1253 1253
                         'body' => $body,
1254 1254
                         'listurl' => $listurl,
1255 1255
                     ];
1256 1256
                     if ($itemdata['htype'] == 11) {
1257 1257
                         # Search result was a subsection heading; fetch the first entry
1258 1258
                         # from the wrans/wms to show under the heading
1259
-                        $input =  [
1259
+                        $input = [
1260 1260
                             'amount' => [
1261 1261
                                 'body' => true,
1262 1262
                                 'speaker' => true,
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 
1503 1503
         $params[':major'] = $this->major;
1504 1504
         $params[':firstdate'] = $firstyear . '-' . $firstmonth . '-01';
1505
-        $q =  $this->db->query("SELECT 	DISTINCT(hdate) AS hdate
1505
+        $q = $this->db->query("SELECT 	DISTINCT(hdate) AS hdate
1506 1506
                         FROM		hansard
1507 1507
                         WHERE		major = :major
1508 1508
                         AND			hdate >= :firstdate
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
 
1571 1571
                 $YEARURL->insert(['y' => $firstyear - 1]);
1572 1572
 
1573
-                $nextprev['prev'] =  [
1573
+                $nextprev['prev'] = [
1574 1574
                     'body' => 'Previous year',
1575 1575
                     'title' => $firstyear - 1,
1576 1576
                     'url' => $YEARURL->generate(),
@@ -1579,8 +1579,8 @@  discard block
 block discarded – undo
1579 1579
             } else {
1580 1580
                 // action is 'year'.
1581 1581
 
1582
-                $nextprev['prev'] =  ['body' => 'Previous year'];
1583
-                $nextprev['next'] =  ['body' => 'Next year'];
1582
+                $nextprev['prev'] = ['body' => 'Previous year'];
1583
+                $nextprev['next'] = ['body' => 'Next year'];
1584 1584
 
1585 1585
                 $q = $this->db->query("SELECT DATE_FORMAT(hdate, '%Y') AS year
1586 1586
                             FROM hansard WHERE major = :major
@@ -1669,13 +1669,13 @@  discard block
 block discarded – undo
1669 1669
         // $input['limit'] as a string for the $limit clause, eg '21,20'.
1670 1670
 
1671 1671
         $amount 		= $input['amount'] ?? [];
1672
-        $wherearr 		= $input['where'] ?? [];
1672
+        $wherearr = $input['where'] ?? [];
1673 1673
         $order 			= $input['order'] ?? '';
1674 1674
         $limit 			= $input['limit'] ?? '';
1675 1675
 
1676 1676
 
1677 1677
         // The fields to fetch from db. 'table' => array ('field1', 'field2').
1678
-        $fieldsarr =  [
1678
+        $fieldsarr = [
1679 1679
             'hansard' =>  ['epobject_id', 'htype', 'gid', 'hpos', 'section_id', 'subsection_id', 'hdate', 'htime', 'source_url', 'major', 'minor', 'colnum'],
1680 1680
         ];
1681 1681
 
@@ -1688,14 +1688,14 @@  discard block
 block discarded – undo
1688 1688
         if ((isset($amount['body']) && $amount['body'] == true) ||
1689 1689
             (isset($amount['comment']) && $amount['comment'] == true)
1690 1690
         ) {
1691
-            $fieldsarr['epobject'] =  ['body'];
1691
+            $fieldsarr['epobject'] = ['body'];
1692 1692
             $join = 'LEFT OUTER JOIN epobject ON hansard.epobject_id = epobject.epobject_id';
1693 1693
         } else {
1694 1694
             $join = '';
1695 1695
         }
1696 1696
 
1697 1697
 
1698
-        $fieldsarr2 =  [];
1698
+        $fieldsarr2 = [];
1699 1699
         // Construct the $fields clause.
1700 1700
         foreach ($fieldsarr as $table => $tablesfields) {
1701 1701
             foreach ($tablesfields as $n => $field) {
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
         }
1705 1705
         $fields = implode(', ', $fieldsarr2);
1706 1706
 
1707
-        $wherearr2 =  [];
1707
+        $wherearr2 = [];
1708 1708
         // Construct the $where clause.
1709 1709
         $i = 0;
1710 1710
         foreach ($wherearr as $key => $val) {
@@ -1862,7 +1862,7 @@  discard block
 block discarded – undo
1862 1862
             // 'commentsurl' is the URL of the item on its own page, with comments.
1863 1863
 
1864 1864
             // All the things we need to work out a listurl!
1865
-            $item_data =  [
1865
+            $item_data = [
1866 1866
                 'major'			=> $this->major,
1867 1867
                 'minor' 		=> $item['minor'],
1868 1868
                 'htype' 		=> $item['htype'],
@@ -1910,7 +1910,7 @@  discard block
 block discarded – undo
1910 1910
             if (isset($amount['comment']) && $amount['comment'] == true) {
1911 1911
 
1912 1912
                 // All the things we need to get the comment data.
1913
-                $item_data =  [
1913
+                $item_data = [
1914 1914
                     'htype' => $item['htype'],
1915 1915
                     'epobject_id' => $item['epobject_id'],
1916 1916
                 ];
@@ -2031,7 +2031,7 @@  discard block
 block discarded – undo
2031 2031
                 $DATA->set_page_metadata('pbc_clause', 'url', "$pbc_url/$id");
2032 2032
                 $LISTURL->remove(['id']);
2033 2033
             } else {
2034
-                $LISTURL->insert([ 'id' => $id_data['gid'] ]);
2034
+                $LISTURL->insert(['id' => $id_data['gid']]);
2035 2035
             }
2036 2036
         } else {
2037 2037
             // A debate speech or question/answer, etc.
@@ -2043,10 +2043,10 @@  discard block
 block discarded – undo
2043 2043
             // Find the gid of this item's (sub)section.
2044 2044
             $parent_gid = '';
2045 2045
 
2046
-            if (isset($this->epobjectid_to_gid[ $parent_epobject_id ])) {
2046
+            if (isset($this->epobjectid_to_gid[$parent_epobject_id])) {
2047 2047
                 // We've previously cached the gid for this epobject_id, so use that.
2048 2048
 
2049
-                $parent_gid = $this->epobjectid_to_gid[ $parent_epobject_id ];
2049
+                $parent_gid = $this->epobjectid_to_gid[$parent_epobject_id];
2050 2050
 
2051 2051
             } else {
2052 2052
                 // We haven't cached the gid, so fetch from db.
@@ -2064,7 +2064,7 @@  discard block
 block discarded – undo
2064 2064
                     $parent_gid = fix_gid_from_db($r['gid']);
2065 2065
 
2066 2066
                     // Cache it for if we need it again:
2067
-                    $this->epobjectid_to_gid[ $parent_epobject_id ] = $parent_gid;
2067
+                    $this->epobjectid_to_gid[$parent_epobject_id] = $parent_gid;
2068 2068
                 }
2069 2069
             }
2070 2070
 
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
                     $DATA->set_page_metadata('pbc_clause', 'url', "$pbc_url/$parent_gid");
2076 2076
                     $LISTURL->remove(['id']);
2077 2077
                 } else {
2078
-                    $LISTURL->insert([ 'id' => $parent_gid ]);
2078
+                    $LISTURL->insert(['id' => $parent_gid]);
2079 2079
                 }
2080 2080
                 // Use a truncated form of this item's gid for the anchor.
2081 2081
                 $fragment = '#g' . gid_to_anchor($id_data['gid']);
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
         $URL->insert(['p' => $person_id]);
2141 2141
 
2142 2142
         $name = member_full_name($member['house'], $member['title'], $member['given_name'], $member['family_name'], $member['lordofname']);
2143
-        $speaker =  [
2143
+        $speaker = [
2144 2144
             'member_id' => $member['member_id'],
2145 2145
             "name" => $name,
2146 2146
             'house' => $member['house'],
@@ -2164,7 +2164,7 @@  discard block
 block discarded – undo
2164 2164
     private function _get_speaker_alone($q, $person_id, $hdate, $htime, $major) {
2165 2165
         $members = $q->fetchAll();
2166 2166
         if (count($members) > 1) {
2167
-            $members = array_filter($members, function ($m) use ($major) {
2167
+            $members = array_filter($members, function($m) use ($major) {
2168 2168
                 $houses = \MySociety\TheyWorkForYou\Utility\House::majorToHouse($major);
2169 2169
                 return in_array($m['house'], $houses);
2170 2170
             });
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
                 )->first();
2273 2273
 
2274 2274
                 // Add this comment to the data structure.
2275
-                $comment =  [
2275
+                $comment = [
2276 2276
                     'comment_id' => $q['comment_id'],
2277 2277
                     'user_id'	=> $q['user_id'],
2278 2278
                     'body'		=> $q['body'],
@@ -2287,7 +2287,7 @@  discard block
 block discarded – undo
2287 2287
         // or subsection itself, only the items within them. So
2288 2288
         // we don't get the most recent comment. Because there isn't one.
2289 2289
 
2290
-        $return =  [
2290
+        $return = [
2291 2291
             'totalcomments' => $totalcomments,
2292 2292
             'comment' => $comment,
2293 2293
         ];
@@ -2350,7 +2350,7 @@  discard block
 block discarded – undo
2350 2350
         // If part of a Written Answer (just question or just answer), select the whole thing
2351 2351
         if (isset($itemdata['major']) && $hansardmajors[$itemdata['major']]['type'] == 'other' and ($itemdata['htype'] == '12' or $itemdata['htype'] == '13' or $itemdata['htype'] == '14')) {
2352 2352
             // find the gid of the subheading which holds this part
2353
-            $input =  [
2353
+            $input = [
2354 2354
                 'amount' => ['gid' => true],
2355 2355
                 'where' =>  [
2356 2356
                     'epobject_id=' => $itemdata['subsection_id'],
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
 
2367 2367
         # If a WMS main heading, go to next gid
2368 2368
         if (isset($itemdata['major']) && $itemdata['major'] == 4 && $itemdata['htype'] == '10') {
2369
-            $input =  [
2369
+            $input = [
2370 2370
                 'amount' => ['gid' => true],
2371 2371
                 'where' => [
2372 2372
                     'section_id=' => $itemdata['epobject_id'],
@@ -2446,7 +2446,7 @@  discard block
 block discarded – undo
2446 2446
                 $nextprev['up']['url'] 		= $sectionrow['listurl'];
2447 2447
                 $nextprev['up']['title'] 	= $sectionrow['body'];
2448 2448
             }
2449
-            $nextprev['up']['body']		= gettext('See the whole debate');
2449
+            $nextprev['up']['body'] = gettext('See the whole debate');
2450 2450
         }
2451 2451
 
2452 2452
         // We can then access this from $PAGE and the templates.
@@ -2455,7 +2455,7 @@  discard block
 block discarded – undo
2455 2455
         // Now get all the non-heading rows.
2456 2456
 
2457 2457
         // What data do we want for each item?
2458
-        $amount =  [
2458
+        $amount = [
2459 2459
             'body' => true,
2460 2460
             'speaker' => true,
2461 2461
             'comment' => true,
@@ -2466,7 +2466,7 @@  discard block
 block discarded – undo
2466 2466
             // This item is a section, so we're displaying all the items within
2467 2467
             // it that aren't within a subsection.
2468 2468
 
2469
-            $input =  [
2469
+            $input = [
2470 2470
                 'amount' => $amount,
2471 2471
                 'where' =>  [
2472 2472
                     'section_id=' => $itemdata['epobject_id'],
@@ -2478,7 +2478,7 @@  discard block
 block discarded – undo
2478 2478
             $data['rows'] = $this->_get_hansard_data($input);
2479 2479
             if (!count($data['rows']) || (count($data['rows']) == 1 && strstr($data['rows'][0]['body'], 'was asked'))) {
2480 2480
 
2481
-                $input =  [
2481
+                $input = [
2482 2482
                     'amount' =>  [
2483 2483
                         'body' => true,
2484 2484
                         'comment' => true,
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
         } elseif ($itemdata['htype'] == '11') {
2501 2501
             // This item is a subsection, so we're displaying everything within it.
2502 2502
 
2503
-            $input =  [
2503
+            $input = [
2504 2504
                 'amount' => $amount,
2505 2505
                 'where' =>  [
2506 2506
                     'subsection_id=' => $itemdata['epobject_id'],
@@ -2537,8 +2537,8 @@  discard block
 block discarded – undo
2537 2537
 
2538 2538
         twfy_debug(get_class($this), "getting data by column");
2539 2539
 
2540
-        $input = [ 'amount' => ['body' => true, 'comment' => true, 'speaker' => true],
2541
-            'where' => [ 'hdate=' => $args['date'], 'major=' => $this->major, 'gid LIKE ' => '%.' . $args['column'] . '.%' ],
2540
+        $input = ['amount' => ['body' => true, 'comment' => true, 'speaker' => true],
2541
+            'where' => ['hdate=' => $args['date'], 'major=' => $this->major, 'gid LIKE ' => '%.' . $args['column'] . '.%'],
2542 2542
             'order' => 'hpos',
2543 2543
         ];
2544 2544
         $data = $this->_get_hansard_data($input);
@@ -2698,10 +2698,10 @@  discard block
 block discarded – undo
2698 2698
                         ", [':major' => $this->major]);
2699 2699
 
2700 2700
         // What we return.
2701
-        $data =  [];
2701
+        $data = [];
2702 2702
         $speeches = [];
2703 2703
         foreach ($q as $row) {
2704
-            $speech =  [
2704
+            $speech = [
2705 2705
                 'subsection_id' => $row['subsection_id'],
2706 2706
                 'section_id' => $row['section_id'],
2707 2707
                 'htype' => $row['htype'],
@@ -2746,7 +2746,7 @@  discard block
 block discarded – undo
2746 2746
             $data['rows'] = $speeches;
2747 2747
 
2748 2748
         } else {
2749
-            $data['rows'] =  [];
2749
+            $data['rows'] = [];
2750 2750
         }
2751 2751
 
2752 2752
         $data['info']['days'] = $days;
@@ -2798,7 +2798,7 @@  discard block
 block discarded – undo
2798 2798
         if ($q) {
2799 2799
 
2800 2800
             // This array just used for getting further data about this debate.
2801
-            $item_data =  [
2801
+            $item_data = [
2802 2802
                 'major'         => $this->major,
2803 2803
                 'minor'         => $q['minor'],
2804 2804
                 'gid'           => fix_gid_from_db($q['gid']),
@@ -2862,7 +2862,7 @@  discard block
 block discarded – undo
2862 2862
                                 ORDER BY hpos
2863 2863
                                 LIMIT 1
2864 2864
                                 ",
2865
-                    [ ':object_id' => $item_data['epobject_id'] ]
2865
+                    [':object_id' => $item_data['epobject_id']]
2866 2866
                 )->first();
2867 2867
                 $childbody = $r['body'];
2868 2868
                 $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
@@ -2901,7 +2901,7 @@  discard block
 block discarded – undo
2901 2901
                 'more_url' => $more_url->generate(),
2902 2902
             ];
2903 2903
 
2904
-            $data =  [
2904
+            $data = [
2905 2905
                 'gid' => $args['gid'],
2906 2906
                 'major' => $this->major,
2907 2907
                 'info' => [],
@@ -2974,7 +2974,7 @@  discard block
 block discarded – undo
2974 2974
         foreach ($q as $row) {
2975 2975
 
2976 2976
             // This array just used for getting further data about this debate.
2977
-            $item_data =  [
2977
+            $item_data = [
2978 2978
                 'major' => $this->major,
2979 2979
                 'gid' => fix_gid_from_db($row['gid']),
2980 2980
                 'htype' => $row['htype'],
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
 
3035 3035
         }
3036 3036
 
3037
-        $data =  [
3037
+        $data = [
3038 3038
             'info' => [],
3039 3039
             'data' => $data,
3040 3040
         ];
@@ -3098,7 +3098,7 @@  discard block
 block discarded – undo
3098 3098
         foreach ($q as $row) {
3099 3099
 
3100 3100
             // This array just used for getting further data about this debate.
3101
-            $item_data =  [
3101
+            $item_data = [
3102 3102
                 'major' => $this->major,
3103 3103
                 'gid' => fix_gid_from_db($row['gid']),
3104 3104
                 'htype' => $row['htype'],
@@ -3107,8 +3107,8 @@  discard block
 block discarded – undo
3107 3107
                 'epobject_id' => $row['epobject_id'],
3108 3108
             ];
3109 3109
 
3110
-            $list_url 		= $this->_get_listurl($item_data);
3111
-            $totalcomments	= $this->_get_comment_count_for_epobject($item_data);
3110
+            $list_url = $this->_get_listurl($item_data);
3111
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
3112 3112
 
3113 3113
             $contentcount = $row['count'];
3114 3114
             $body = $row['body'];
@@ -3116,7 +3116,7 @@  discard block
 block discarded – undo
3116 3116
 
3117 3117
 
3118 3118
             // This array will be added to $data, which is what gets returned.
3119
-            $debate =  [
3119
+            $debate = [
3120 3120
                 'contentcount'	=> $contentcount,
3121 3121
                 'body'			=> $body,
3122 3122
                 'hdate'			=> $hdate,
@@ -3156,7 +3156,7 @@  discard block
 block discarded – undo
3156 3156
             $data[] = $debate;
3157 3157
         }
3158 3158
 
3159
-        $data =  [
3159
+        $data = [
3160 3160
             'info' => [],
3161 3161
             'data' => $data,
3162 3162
         ];
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
 
3245 3245
         foreach ($q as $row) {
3246 3246
             // This array just used for getting further data about this debate.
3247
-            $item_data =  [
3247
+            $item_data = [
3248 3248
                 'major' => $this->major,
3249 3249
                 'gid' => fix_gid_from_db($row['gid']),
3250 3250
                 'htype' => $row['htype'],
@@ -3253,8 +3253,8 @@  discard block
 block discarded – undo
3253 3253
                 'epobject_id' => $row['epobject_id'],
3254 3254
             ];
3255 3255
 
3256
-            $list_url 		= $this->_get_listurl($item_data);
3257
-            $totalcomments	= $this->_get_comment_count_for_epobject($item_data);
3256
+            $list_url = $this->_get_listurl($item_data);
3257
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
3258 3258
 
3259 3259
             $body = $row['body'];
3260 3260
             $hdate = $row['hdate'];
@@ -3282,7 +3282,7 @@  discard block
 block discarded – undo
3282 3282
             $childbody = $r['body'];
3283 3283
             $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
3284 3284
 
3285
-            $data[] =  [
3285
+            $data[] = [
3286 3286
                 'body'			=> $body,
3287 3287
                 'hdate'			=> $hdate,
3288 3288
                 'list_url'		=> $list_url,
@@ -3298,7 +3298,7 @@  discard block
 block discarded – undo
3298 3298
 
3299 3299
         }
3300 3300
 
3301
-        $data =  [
3301
+        $data = [
3302 3302
             'info' => [],
3303 3303
             'data' => $data,
3304 3304
         ];
@@ -3358,7 +3358,7 @@  discard block
 block discarded – undo
3358 3358
     public function _get_data_by_bill($args) {
3359 3359
         global $DATA, $this_page;
3360 3360
         $data = [];
3361
-        $input =  [
3361
+        $input = [
3362 3362
             'amount' =>  [
3363 3363
                 'body' => true,
3364 3364
                 'comment' => true,
@@ -3380,7 +3380,7 @@  discard block
 block discarded – undo
3380 3380
                 [$sitting, $part] = $this->_get_sitting($sectionrow['gid']);
3381 3381
                 $sectionrow['sitting'] = $sitting;
3382 3382
                 $sectionrow['part'] = $part;
3383
-                $input =  [
3383
+                $input = [
3384 3384
                     'amount' =>  [
3385 3385
                         'body' => true,
3386 3386
                         'comment' => true,
@@ -3451,8 +3451,8 @@  discard block
 block discarded – undo
3451 3451
 
3452 3452
         $YEARURL = new \MySociety\TheyWorkForYou\Url('pbc_session');
3453 3453
         $nextprev = [];
3454
-        $nextprev['prev'] =  ['body' => 'Previous session', 'title' => ''];
3455
-        $nextprev['next'] =  ['body' => 'Next session', 'title' => ''];
3454
+        $nextprev['prev'] = ['body' => 'Previous session', 'title' => ''];
3455
+        $nextprev['next'] = ['body' => 'Next session', 'title' => ''];
3456 3456
         $q = $this->db->query(
3457 3457
             "SELECT session FROM bills WHERE session < :session ORDER BY session DESC LIMIT 1",
3458 3458
             [':session' => $session]
Please login to merge, or discard this patch.