Completed
Pull Request — master (#1389)
by Struan
06:35
created
www/includes/easyparliament/templates/html/section/_section_content.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
         if ($hansardmajors[$data['info']['major']]['location'] == 'Scotland') {
13 13
             $body = preg_replace('# (S\d[O0WF]-\d+)[, ]#', ' <a href="/spwrans/?spid=$1">$1</a> ', $body);
14 14
             $body = preg_replace_callback('#<citation id="uk\.org\.publicwhip/(.*?)/(.*?)">\[(.*?)\]</citation>#', function($matches) {
15
-                   if ($matches[1] == 'spor') {
16
-                       $href_segment = 'sp/?g';
17
-                   } elseif ($matches[1] == 'spwa') {
15
+                    if ($matches[1] == 'spor') {
16
+                        $href_segment = 'sp/?g';
17
+                    } elseif ($matches[1] == 'spwa') {
18 18
                         $href_segment = 'spwrans/?';
19 19
                     } else {
20 20
                         $href_segment = 'debates/?';
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                 $before_mp = isset($speech['before_mp']);
188 188
                 $after_mp = isset($speech['after_mp']);
189 189
                 include dirname(__FILE__) . '/../divisions/_your_mp.php';
190
-              } ?>
190
+                } ?>
191 191
                 <div class="debate-speech__division__details">
192 192
                   <?php include dirname(__FILE__) . '/../divisions/_votes.php'; ?>
193 193
                 </div>
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-  <?php foreach($data['rows'] as $speech) { ?>
1
+  <?php foreach ($data['rows'] as $speech) { ?>
2 2
 
3 3
     <?php
4 4
 
@@ -61,27 +61,27 @@  discard block
 block discarded – undo
61 61
     $source = array();
62 62
 
63 63
     $major = $data['info']['major'];
64
-    if ($major==1 || $major==2 || (($major==3 || $major==4) && isset($speech['speaker']['house'])) || $major==101 || $major==6) {
64
+    if ($major == 1 || $major == 2 || (($major == 3 || $major == 4) && isset($speech['speaker']['house'])) || $major == 101 || $major == 6) {
65 65
         $source['title'] = 'Citation: ';
66
-        if ($major==1 || $major==2) {
66
+        if ($major == 1 || $major == 2) {
67 67
             $source['title'] .= 'HC';
68
-        } elseif ($major==3 || $major==4) {
69
-            if ($speech['speaker']['house']==1) {
68
+        } elseif ($major == 3 || $major == 4) {
69
+            if ($speech['speaker']['house'] == 1) {
70 70
                 $source['title'] .= 'HC';
71 71
             } else {
72 72
                 $source['title'] .= 'HL';
73 73
             }
74
-        } elseif ($major==6) {
74
+        } elseif ($major == 6) {
75 75
             $source['title'] .= $data['section_title'];
76 76
         } else {
77 77
             $source['title'] .= 'HL';
78 78
         }
79 79
         $source['title'] .= ' Deb, ' . format_date($data['info']['date'], LONGDATEFORMAT) . ', c' . $speech['colnum'];
80
-        if ($major==2) {
80
+        if ($major == 2) {
81 81
             $source['title'] .= 'WH';
82
-        } elseif ($major==3) {
82
+        } elseif ($major == 3) {
83 83
             $source['title'] .= 'W';
84
-        } elseif ($major==4) {
84
+        } elseif ($major == 4) {
85 85
             $source['title'] .= 'WS';
86 86
         }
87 87
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             <div class="debate-speech__speaker-and-content">
111 111
             <?php } ?>
112 112
 
113
-          <?php if(isset($speech['speaker']) && count($speech['speaker']) > 0) { ?>
113
+          <?php if (isset($speech['speaker']) && count($speech['speaker']) > 0) { ?>
114 114
             <h2 class="debate-speech__speaker">
115 115
                 <?php
116 116
 
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
                 <?php if ($division['has_description']) { ?>
178 178
                 <div class="debate-speech__division__details">
179 179
                     <span class="policy-vote__text">
180
-                        <?php include( dirname(__FILE__) . '/../divisions/_vote_description.php'); ?>
180
+                        <?php include(dirname(__FILE__) . '/../divisions/_vote_description.php'); ?>
181 181
                     </span><br>
182 182
                 </div>
183 183
                 <?php } ?>
184 184
 
185 185
               <?php if (isset($speech['mp_vote'])) {
186
-                $mp_vote = array( 'vote' => $speech['mp_vote']['vote'] );
186
+                $mp_vote = array('vote' => $speech['mp_vote']['vote']);
187 187
                 $before_mp = isset($speech['before_mp']);
188 188
                 $after_mp = isset($speech['after_mp']);
189 189
                 include dirname(__FILE__) . '/../divisions/_your_mp.php';
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             <div class="debate-speech__content"><?=$body ?></div>
196 196
             <?php } ?>
197 197
 
198
-            <?php if ( $section ) {
198
+            <?php if ($section) {
199 199
                 if ($speech['voting_data']) { ?>
200 200
 
201 201
                 <div class="debate-speech__question-answered">
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 
221 221
                 // Video
222 222
                 if ($data['info']['major'] == 1 && !$individual_item) { # Commons debates only
223
-                    if ($speech['video_status']&4) { ?>
223
+                    if ($speech['video_status'] & 4) { ?>
224 224
                         <a href="<?= $speech['commentsurl'] ?>" class="watch debate-speech__meta__link" onclick="return moveVideo(\'debate/'<?= $speech['gid'] ?>\');">Watch this</a>
225 225
                     <?php
226
-                    } elseif (!$speech['video'] && $speech['video_status']&1 && !($speech['video_status']&8)) {
226
+                    } elseif (!$speech['video'] && $speech['video_status'] & 1 && !($speech['video_status'] & 8)) {
227 227
                         $gid_type = $data['info']['major'] == 1 ? 'debate' : 'lords'; ?>
228 228
                         <a href="/video/?from=debate&amp;gid=<?= $gid_type ?>/<?= $speech['gid'] ?>" class="timestamp debate-speech__meta__link">Video match this</a>
229 229
                     <?php
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
                     $moreinfo[] = $row['totalcomments'] . " $plural";
351 351
                 }
352 352
                 if (count($moreinfo) > 0) {
353
-                    print "<small>(" . implode (', ', $moreinfo) . ") </small>";
353
+                    print "<small>(" . implode(', ', $moreinfo) . ") </small>";
354 354
                 }
355 355
             } else {
356 356
                 // Nothing in this item, so no link.
Please login to merge, or discard this patch.
www/includes/easyparliament/hansardlist.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1840,14 +1840,14 @@
 block discarded – undo
1840 1840
                     $division_votes = $divisions->getDivisionByGid($this->gidprefix . $item['gid']);
1841 1841
                     $item['division'] = $division_votes;
1842 1842
                     if (isset($MEMBER)) {
1843
-                      $item['mp_vote'] = $divisions->getDivisionResultsForMember($division_votes['division_id'], $MEMBER->person_id());
1844
-                      if (!$item['mp_vote']) {
1845
-                          if ($division_votes['date'] < $MEMBER->entered_house($division_votes['house_number'])['date']) {
1846
-                              $item['before_mp'] = true;
1847
-                          } else if ($division_votes['date'] > $MEMBER->left_house($division_votes['house_number'])['date']) {
1848
-                              $item['after_mp'] = true;
1849
-                          }
1850
-                      }
1843
+                        $item['mp_vote'] = $divisions->getDivisionResultsForMember($division_votes['division_id'], $MEMBER->person_id());
1844
+                        if (!$item['mp_vote']) {
1845
+                            if ($division_votes['date'] < $MEMBER->entered_house($division_votes['house_number'])['date']) {
1846
+                                $item['before_mp'] = true;
1847
+                            } else if ($division_votes['date'] > $MEMBER->left_house($division_votes['house_number'])['date']) {
1848
+                                $item['after_mp'] = true;
1849
+                            }
1850
+                        }
1851 1851
                     }
1852 1852
                 }
1853 1853
 
Please login to merge, or discard this patch.
tests/DivisionsTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
     }
18 18
 
19 19
     private function fetch_division_page() {
20
-        return $this->fetch_page( array( 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ) );
20
+        return $this->fetch_page(array('pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions'));
21 21
     }
22 22
 
23 23
     private function fetch_mp_recent_page()
24 24
     {
25
-        $vars = array( 'pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent' );
25
+        $vars = array('pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent');
26 26
         return $this->base_fetch_page($vars, 'mp', 'index.php', '/mp/recent.php');
27 27
     }
28 28
 
29 29
     private function fetch_recent_page() {
30
-        return $this->base_fetch_page( array('url' => '/divisions' ), 'divisions', 'index.php', '/divisions/index.php' );
30
+        return $this->base_fetch_page(array('url' => '/divisions'), 'divisions', 'index.php', '/divisions/index.php');
31 31
     }
32 32
 
33 33
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     }
114 114
 
115 115
     public function testNotEnoughInfoStatement() {
116
-        return $this->fetch_page( array( 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ) );
116
+        return $this->fetch_page(array('pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions'));
117 117
         $this->assertContains('we don&rsquo;t have enough information to calculate Test Current-MP&rsquo;s position', $page);
118 118
     }
119 119
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     }
125 125
 
126 126
     public function testSingleDivision() {
127
-        $page = $this->base_fetch_page( array('url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons' ), 'divisions', 'division.php', '/divisions/division.php' );
127
+        $page = $this->base_fetch_page(array('url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons'), 'divisions', 'division.php', '/divisions/division.php');
128 128
         $this->assertContains('A majority of MPs  <b>voted in favour</b> of a thing', $page);
129 129
         $this->assertContains('Aye: 1', $page);
130 130
         $this->assertNotContains('No:', $page);
Please login to merge, or discard this patch.