Failed Conditions
Pull Request — master (#1328)
by Nick
33:04 queued 18:05
created
classes/Divisions.php 3 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -38,25 +38,25 @@  discard block
 block discarded – undo
38 38
     }
39 39
 
40 40
     public static function getMostRecentDivisionDate() {
41
-      $db = new \ParlDB;
42
-      $q = $db->query(
41
+        $db = new \ParlDB;
42
+        $q = $db->query(
43 43
         "SELECT policy_id, max(division_date) as recent from policydivisions GROUP BY policy_id"
44
-      );
44
+        );
45 45
 
46
-      $policy_maxes = array();
47
-      $row_count = $q->rows();
48
-      for ($n = 0; $n < $row_count; $n++) {
46
+        $policy_maxes = array();
47
+        $row_count = $q->rows();
48
+        for ($n = 0; $n < $row_count; $n++) {
49 49
         $policy_maxes[$q->field($n, 'policy_id')] = $q->field( $n, 'recent' );
50
-      }
51
-      $policy_maxes['latest'] = $policy_maxes ? max(array_values($policy_maxes)) : '';
52
-      return $policy_maxes;
50
+        }
51
+        $policy_maxes['latest'] = $policy_maxes ? max(array_values($policy_maxes)) : '';
52
+        return $policy_maxes;
53 53
     }
54 54
 
55 55
     public function getRecentDivisions($number = 20) {
56 56
         // Grab distinct divisions as sometimes we have the same division for more than one policy
57 57
         // and we don't want to display it twice
58 58
         $q = $this->db->query(
59
-          "SELECT distinct division_id, division_title, yes_text, no_text, division_date, division_number, gid, direction, majority_vote,
59
+            "SELECT distinct division_id, division_title, yes_text, no_text, division_date, division_number, gid, direction, majority_vote,
60 60
           yes_total, no_total, absent_total, both_total
61 61
           FROM policydivisions ORDER BY division_date DESC, division_number DESC LIMIT :count",
62 62
             array(
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $divisions = array();
95 95
         $row_count = $q->rows();
96 96
         for ($n = 0; $n < $row_count; $n++) {
97
-          $divisions[] = $this->getParliamentDivisionDetails($q->row($n));
97
+            $divisions[] = $this->getParliamentDivisionDetails($q->row($n));
98 98
         }
99 99
 
100 100
         return $divisions;
@@ -148,44 +148,44 @@  discard block
 block discarded – undo
148 148
 
149 149
         $row_count = $q->rows();
150 150
         for ($n = 0; $n < $row_count; $n++) {
151
-          $policy_id = $q->field($n, 'policy_id');
151
+            $policy_id = $q->field($n, 'policy_id');
152 152
 
153
-          if (!array_key_exists($policy_id, $policy_divisions)) {
153
+            if (!array_key_exists($policy_id, $policy_divisions)) {
154 154
             $summary = array(
155
-              'max' => $q->field($n, 'latest'),
156
-              'min' => $q->field($n, 'earliest'),
157
-              'total' => $q->field($n, 'total'),
158
-              'for' => 0, 'against' => 0, 'absent' => 0, 'both' => 0, 'tell' => 0
155
+                'max' => $q->field($n, 'latest'),
156
+                'min' => $q->field($n, 'earliest'),
157
+                'total' => $q->field($n, 'total'),
158
+                'for' => 0, 'against' => 0, 'absent' => 0, 'both' => 0, 'tell' => 0
159 159
             );
160 160
 
161 161
             $policy_divisions[$policy_id] = $summary;
162
-          }
163
-
164
-          $summary = $policy_divisions[$policy_id];
165
-
166
-          $summary['total'] += $q->field($n, 'total');
167
-          if ($summary['max'] < $q->field($n, 'latest')) {
168
-              $summary['max'] = $q->field($n, 'latest');
169
-          }
170
-          if ($summary['min'] > $q->field($n, 'latest')) {
171
-              $summary['min'] = $q->field($n, 'latest');
172
-          }
173
-
174
-          $vote = $q->field($n, 'vote');
175
-          $policy_vote = str_replace('3', '', $q->field($n, 'policy_vote'));
176
-          if ( $vote == 'absent' ) {
177
-              $summary['absent'] += $q->field($n, 'total');
178
-          } else if ( $vote == 'both' ) {
179
-              $summary['both'] += $q->field($n, 'total');
180
-          } else if ( strpos($vote, 'tell') !== FALSE ) {
181
-              $summary['tell'] += $q->field($n, 'total');
182
-          } else if ( $policy_vote == $vote ) {
183
-              $summary['for'] += $q->field($n, 'total');
184
-          } else if ( $policy_vote != $vote ) {
185
-              $summary['against'] += $q->field($n, 'total');
186
-          }
187
-
188
-          $policy_divisions[$policy_id] = $summary;
162
+            }
163
+
164
+            $summary = $policy_divisions[$policy_id];
165
+
166
+            $summary['total'] += $q->field($n, 'total');
167
+            if ($summary['max'] < $q->field($n, 'latest')) {
168
+                $summary['max'] = $q->field($n, 'latest');
169
+            }
170
+            if ($summary['min'] > $q->field($n, 'latest')) {
171
+                $summary['min'] = $q->field($n, 'latest');
172
+            }
173
+
174
+            $vote = $q->field($n, 'vote');
175
+            $policy_vote = str_replace('3', '', $q->field($n, 'policy_vote'));
176
+            if ( $vote == 'absent' ) {
177
+                $summary['absent'] += $q->field($n, 'total');
178
+            } else if ( $vote == 'both' ) {
179
+                $summary['both'] += $q->field($n, 'total');
180
+            } else if ( strpos($vote, 'tell') !== FALSE ) {
181
+                $summary['tell'] += $q->field($n, 'total');
182
+            } else if ( $policy_vote == $vote ) {
183
+                $summary['for'] += $q->field($n, 'total');
184
+            } else if ( $policy_vote != $vote ) {
185
+                $summary['against'] += $q->field($n, 'total');
186
+            }
187
+
188
+            $policy_divisions[$policy_id] = $summary;
189 189
         }
190 190
 
191 191
         return $policy_divisions;
@@ -219,17 +219,17 @@  discard block
 block discarded – undo
219 219
         );
220 220
 
221 221
         $votes = array(
222
-          'yes_votes' => array(),
223
-          'no_votes' => array(),
224
-          'absent_votes' => array(),
225
-          'both_votes' => array()
222
+            'yes_votes' => array(),
223
+            'no_votes' => array(),
224
+            'absent_votes' => array(),
225
+            'both_votes' => array()
226 226
         );
227 227
 
228 228
         foreach ($q->data as $vote) {
229 229
             $detail = array(
230
-              'person_id' => $vote['person_id'],
231
-              'name' => $vote['given_name'] . ' ' . $vote['family_name'],
232
-              'teller' => false
230
+                'person_id' => $vote['person_id'],
231
+                'name' => $vote['given_name'] . ' ' . $vote['family_name'],
232
+                'teller' => false
233 233
             );
234 234
 
235 235
             if (strpos($vote['vote'], 'tell') !== FALSE) {
@@ -237,13 +237,13 @@  discard block
 block discarded – undo
237 237
             }
238 238
 
239 239
             if ($vote['vote'] == 'aye' or $vote['vote'] == 'tellaye') {
240
-              $votes['yes_votes'][] = $detail;
240
+                $votes['yes_votes'][] = $detail;
241 241
             } else if ($vote['vote'] == 'no' or $vote['vote'] == 'tellno') {
242
-              $votes['no_votes'][] = $detail;
242
+                $votes['no_votes'][] = $detail;
243 243
             } else if ($vote['vote'] == 'absent') {
244
-              $votes['absent_votes'][] = $detail;
244
+                $votes['absent_votes'][] = $detail;
245 245
             } else if ($vote['vote'] == 'both') {
246
-              $votes['both_votes'][] = $detail;
246
+                $votes['both_votes'][] = $detail;
247 247
             }
248 248
 
249 249
         }
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
         $divisions = array();
339 339
         $row_count = $q->rows();
340 340
         for ($n = 0; $n < $row_count; $n++) {
341
-          if ($context == 'Parliament') {
342
-              $divisions[] = $this->getParliamentDivisionDetails($q->row($n));
343
-          } else {
344
-              $divisions[] = $this->getDivisionDetails($q->row($n));
345
-          }
341
+            if ($context == 'Parliament') {
342
+                $divisions[] = $this->getParliamentDivisionDetails($q->row($n));
343
+            } else {
344
+                $divisions[] = $this->getDivisionDetails($q->row($n));
345
+            }
346 346
         }
347 347
 
348 348
         return $divisions;
@@ -444,13 +444,13 @@  discard block
 block discarded – undo
444 444
 
445 445
         $division['mp_vote'] = '';
446 446
         if (array_key_exists('vote', $row)) {
447
-          $mp_vote = ' was absent';
448
-          if ($row['vote'] == 'aye') {
449
-              $mp_vote = 'voted in favour';
450
-          } else if ($row['vote'] == 'no') {
451
-              $mp_vote = 'voted against';
452
-          }
453
-          $division['mp_vote'] = $mp_vote;
447
+            $mp_vote = ' was absent';
448
+            if ($row['vote'] == 'aye') {
449
+                $mp_vote = 'voted in favour';
450
+            } else if ($row['vote'] == 'no') {
451
+                $mp_vote = 'voted against';
452
+            }
453
+            $division['mp_vote'] = $mp_vote;
454 454
         }
455 455
         $division['division_title'] = $row['division_title'];
456 456
         $division['vote'] = $vote;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * @param Member   $member   The member to get positions for.
30 30
      */
31 31
 
32
-    public function __construct(Member $member = NULL, PolicyPositions $positions = NULL, Policies $policies = NULL)
32
+    public function __construct(Member $member = null, PolicyPositions $positions = null, Policies $policies = null)
33 33
     {
34 34
         $this->member = $member;
35 35
         $this->positions = $positions;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
               $summary['absent'] += $q->field($n, 'total');
178 178
           } else if ( $vote == 'both' ) {
179 179
               $summary['both'] += $q->field($n, 'total');
180
-          } else if ( strpos($vote, 'tell') !== FALSE ) {
180
+          } else if ( strpos($vote, 'tell') !== false ) {
181 181
               $summary['tell'] += $q->field($n, 'total');
182 182
           } else if ( $policy_vote == $vote ) {
183 183
               $summary['for'] += $q->field($n, 'total');
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
               'teller' => false
233 233
             );
234 234
 
235
-            if (strpos($vote['vote'], 'tell') !== FALSE) {
235
+            if (strpos($vote['vote'], 'tell') !== false) {
236 236
                 $detail['teller'] = true;
237 237
             }
238 238
 
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
         $division = array();
400 400
 
401 401
         $direction = $row['direction'];
402
-        if ( strpos( $direction, 'strong') !== FALSE ) {
403
-            $division['strong'] = TRUE;
402
+        if ( strpos( $direction, 'strong') !== false ) {
403
+            $division['strong'] = true;
404 404
         } else {
405
-            $division['strong'] = FALSE;
405
+            $division['strong'] = false;
406 406
         }
407 407
 
408 408
         $division['division_id'] = $row['division_id'];
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
       $policy_maxes = array();
47 47
       $row_count = $q->rows();
48 48
       for ($n = 0; $n < $row_count; $n++) {
49
-        $policy_maxes[$q->field($n, 'policy_id')] = $q->field( $n, 'recent' );
49
+        $policy_maxes[$q->field($n, 'policy_id')] = $q->field($n, 'recent');
50 50
       }
51 51
       $policy_maxes['latest'] = $policy_maxes ? max(array_values($policy_maxes)) : '';
52 52
       return $policy_maxes;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     public function getMemberDivisionsForPolicy($policyID = null) {
118 118
         $where_extra = '';
119 119
         $args = array(':person_id' => $this->member->person_id);
120
-        if ( $policyID ) {
120
+        if ($policyID) {
121 121
             $where_extra = 'AND policy_id = :policy_id';
122 122
             $args[':policy_id'] = $policyID;
123 123
         }
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
 
174 174
           $vote = $q->field($n, 'vote');
175 175
           $policy_vote = str_replace('3', '', $q->field($n, 'policy_vote'));
176
-          if ( $vote == 'absent' ) {
176
+          if ($vote == 'absent') {
177 177
               $summary['absent'] += $q->field($n, 'total');
178
-          } else if ( $vote == 'both' ) {
178
+          } else if ($vote == 'both') {
179 179
               $summary['both'] += $q->field($n, 'total');
180
-          } else if ( strpos($vote, 'tell') !== FALSE ) {
180
+          } else if (strpos($vote, 'tell') !== FALSE) {
181 181
               $summary['tell'] += $q->field($n, 'total');
182
-          } else if ( $policy_vote == $vote ) {
182
+          } else if ($policy_vote == $vote) {
183 183
               $summary['for'] += $q->field($n, 'total');
184
-          } else if ( $policy_vote != $vote ) {
184
+          } else if ($policy_vote != $vote) {
185 185
               $summary['against'] += $q->field($n, 'total');
186 186
           }
187 187
 
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
             $votes['against'] . ' ' . make_plural('vote', $votes['against']) . ' against'
285 285
         );
286 286
 
287
-        if ( $votes['both'] ) {
287
+        if ($votes['both']) {
288 288
             $actions[] = $votes['both'] . ' ' . make_plural('abstention', $votes['both']);
289 289
         }
290
-        if ( $votes['absent'] ) {
290
+        if ($votes['absent']) {
291 291
             $actions[] = $votes['absent'] . ' ' . make_plural('absence', $votes['absent']);
292 292
         }
293 293
         if ($max == $min) {
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 
352 352
     private function constructYesNoVoteDescription($direction, $title, $short_text) {
353 353
         $text = ' voted ';
354
-        if ( $short_text ) {
354
+        if ($short_text) {
355 355
             $text .= $short_text;
356 356
         } else {
357 357
             $text .= "$direction on <em>$title</em>";
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
          * votes so we need to generate some text using the title of the division
370 370
          */
371 371
 
372
-        switch ( strtolower($vote) ) {
372
+        switch (strtolower($vote)) {
373 373
             case 'yes':
374 374
             case 'aye':
375 375
                 $description = $this->constructYesNoVoteDescription('yes', $division_title, $yes_text);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         $division = array();
400 400
 
401 401
         $direction = $row['direction'];
402
-        if ( strpos( $direction, 'strong') !== FALSE ) {
402
+        if (strpos($direction, 'strong') !== FALSE) {
403 403
             $division['strong'] = TRUE;
404 404
         } else {
405 405
             $division['strong'] = FALSE;
@@ -471,24 +471,24 @@  discard block
 block discarded – undo
471 471
         for ($n = 0; $n < $row_count; $n++) {
472 472
             $policy_id = $q->field($n, 'policy_id');
473 473
 
474
-            if ( !array_key_exists($policy_id, $policies) ) {
474
+            if (!array_key_exists($policy_id, $policies)) {
475 475
                 $policies[$policy_id] = array(
476 476
                     'policy_id' => $policy_id,
477 477
                     'weak_count' => 0,
478 478
                     'divisions' => array()
479 479
                 );
480
-                if ( $this->policies ) {
480
+                if ($this->policies) {
481 481
                     $policies[$policy_id]['desc'] = $this->policies->getPolicies()[$policy_id];
482 482
                     $policies[$policy_id]['header'] = $this->policies->getPolicyDetails($policy_id);
483 483
                 }
484
-                if ( $this->positions ) {
484
+                if ($this->positions) {
485 485
                     $policies[$policy_id]['position'] = $this->positions->positionsById[$policy_id];
486 486
                 }
487 487
             }
488 488
 
489 489
             $division = $this->getDivisionDetails($q->row($n));
490 490
 
491
-            if ( !$division['strong'] ) {
491
+            if (!$division['strong']) {
492 492
                 $policies[$policy_id]['weak_count']++;
493 493
             }
494 494
 
@@ -503,9 +503,9 @@  discard block
 block discarded – undo
503 503
 
504 504
         $gid = get_canonical_gid($gid);
505 505
 
506
-        $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", array( ':gid' => $gid ));
506
+        $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", array(':gid' => $gid));
507 507
         $parent_gid = $q->field(0, 'gid');
508
-        if ( !$parent_gid ) {
508
+        if (!$parent_gid) {
509 509
             return '';
510 510
         }
511 511
         $parent_gid = fix_gid_from_db($parent_gid);
Please login to merge, or discard this patch.
classes/Party.php 3 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     public function __construct($name) {
21 21
         // treat Labour and Labour/Co-operative the same as that's how
22 22
         // people view them and it'll confuse the results otherwise
23
-        if ( $name == 'Labour/Co-operative' ) {
23
+        if ($name == 'Labour/Co-operative') {
24 24
             $name = 'Labour';
25 25
         }
26 26
         $this->name = $name;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                 ':date' => date('Y-m-d'),
43 43
             )
44 44
         );
45
-        if ( $member_count->rows ) {
45
+        if ($member_count->rows) {
46 46
             $num_members = $member_count->field(0, 'num_members');
47 47
             return $num_members;
48 48
         } else {
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
             )
71 71
         );
72 72
 
73
-        if ( $position->rows ) {
73
+        if ($position->rows) {
74 74
             $score = $position->field(0, 'score');
75 75
             $score_desc = score_to_strongly($score);
76 76
 
77
-            if ( $want_score ) {
78
-                return array( $score_desc, $score);
77
+            if ($want_score) {
78
+                return array($score_desc, $score);
79 79
             } else {
80 80
                 return $score_desc;
81 81
             }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             ':party' => $this->name
115 115
         );
116 116
 
117
-        if ( $this->name == 'Labour' ) {
117
+        if ($this->name == 'Labour') {
118 118
             $party_where = '( party = :party OR party = :party2 )';
119 119
             $params = array(
120 120
                 ':party' => $this->name,
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             );
123 123
         }
124 124
 
125
-        for ( $i = 0; $i < $num_divs; $i++ ) {
125
+        for ($i = 0; $i < $num_divs; $i++) {
126 126
             $division_id = $divisions->field($i, 'division_id');
127 127
             $weights = $this->get_vote_scores($divisions->field($i, 'policy_vote'));
128 128
 
@@ -142,42 +142,42 @@  discard block
 block discarded – undo
142 142
             );
143 143
 
144 144
             $num_votes = 0;
145
-            for ( $j = 0; $j < $votes->rows(); $j++ ) {
145
+            for ($j = 0; $j < $votes->rows(); $j++) {
146 146
                 $vote_dir = $votes->field($j, 'vote');
147
-                if ( $vote_dir == '' ) continue;
148
-                if ( $vote_dir == 'tellno' ) $vote_dir = 'no';
149
-                if ( $vote_dir == 'tellaye' ) $vote_dir = 'aye';
147
+                if ($vote_dir == '') continue;
148
+                if ($vote_dir == 'tellno') $vote_dir = 'no';
149
+                if ($vote_dir == 'tellaye') $vote_dir = 'aye';
150 150
 
151 151
                 $num_votes += $votes->field($j, 'num_votes');
152 152
                 $score += ($votes->field($j, 'num_votes') * $weights[$vote_dir]);
153 153
             }
154 154
 
155 155
             $total_votes += $num_votes;
156
-            $max_score += $num_votes * max( array_values( $weights ) );
156
+            $max_score += $num_votes * max(array_values($weights));
157 157
         }
158 158
 
159
-        if ( $total_votes == 0 ) {
159
+        if ($total_votes == 0) {
160 160
             return null;
161 161
         }
162 162
 
163 163
         // this implies that all the divisions in the policy have a policy
164 164
         // position of absent so we set weight to -1 to indicate we can't
165 165
         // really say what the parties position is.
166
-        if ( $max_score == 0 ) {
166
+        if ($max_score == 0) {
167 167
             $weight = -1;
168 168
         } else {
169
-            $weight = 1 - ( $score/$max_score );
169
+            $weight = 1 - ($score / $max_score);
170 170
         }
171 171
         $score_desc = score_to_strongly($weight);
172 172
 
173
-        if ( $want_score ) {
174
-            return array( $score_desc, $weight);
173
+        if ($want_score) {
174
+            return array($score_desc, $weight);
175 175
         } else {
176 176
             return $score_desc;
177 177
         }
178 178
     }
179 179
 
180
-    public function cache_position( $position ) {
180
+    public function cache_position($position) {
181 181
         $this->db->query(
182 182
             "REPLACE INTO partypolicy
183 183
                 (party, house, policy_id, score)
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
             return $positions;
198 198
         }
199 199
 
200
-        foreach ( $policies->getPolicies() as $policy_id => $policy_text ) {
201
-            list( $position, $score ) = $this->$method($policy_id, true);
202
-            if ( $position === null ) {
200
+        foreach ($policies->getPolicies() as $policy_id => $policy_text) {
201
+            list($position, $score) = $this->$method($policy_id, true);
202
+            if ($position === null) {
203 203
                 continue;
204 204
             }
205 205
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         $both = 1;
220 220
         $agree = 10;
221 221
 
222
-        if ( stripos($vote, '3') !== FALSE ) {
222
+        if (stripos($vote, '3') !== FALSE) {
223 223
             $agree = 50;
224 224
             $absent = 25;
225 225
             $both = 25;
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
             'both' => $both
231 231
         );
232 232
 
233
-        if ( stripos($vote, 'aye') !== FALSE ) {
233
+        if (stripos($vote, 'aye') !== FALSE) {
234 234
             $scores['aye'] = $agree;
235 235
             $scores['no'] = 0;
236
-        } else if ( stripos($vote, 'no') !== FALSE ) {
236
+        } else if (stripos($vote, 'no') !== FALSE) {
237 237
             $scores['no'] = $agree;
238 238
             $scores['aye'] = 0;
239 239
         } else {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         $parties = array();
257 257
         $party_count = $party_list->rows;
258 258
 
259
-        for ( $i = 0; $i < $party_count; $i++ ) {
259
+        for ($i = 0; $i < $party_count; $i++) {
260 260
             $party = $party_list->field($i, 'party');
261 261
             if (
262 262
                 !$party
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -144,9 +144,15 @@
 block discarded – undo
144 144
             $num_votes = 0;
145 145
             for ( $j = 0; $j < $votes->rows(); $j++ ) {
146 146
                 $vote_dir = $votes->field($j, 'vote');
147
-                if ( $vote_dir == '' ) continue;
148
-                if ( $vote_dir == 'tellno' ) $vote_dir = 'no';
149
-                if ( $vote_dir == 'tellaye' ) $vote_dir = 'aye';
147
+                if ( $vote_dir == '' ) {
148
+                    continue;
149
+                }
150
+                if ( $vote_dir == 'tellno' ) {
151
+                    $vote_dir = 'no';
152
+                }
153
+                if ( $vote_dir == 'tellaye' ) {
154
+                    $vote_dir = 'aye';
155
+                }
150 156
 
151 157
                 $num_votes += $votes->field($j, 'num_votes');
152 158
                 $score += ($votes->field($j, 'num_votes') * $weights[$vote_dir]);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         $both = 1;
220 220
         $agree = 10;
221 221
 
222
-        if ( stripos($vote, '3') !== FALSE ) {
222
+        if ( stripos($vote, '3') !== false ) {
223 223
             $agree = 50;
224 224
             $absent = 25;
225 225
             $both = 25;
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
             'both' => $both
231 231
         );
232 232
 
233
-        if ( stripos($vote, 'aye') !== FALSE ) {
233
+        if ( stripos($vote, 'aye') !== false ) {
234 234
             $scores['aye'] = $agree;
235 235
             $scores['no'] = 0;
236
-        } else if ( stripos($vote, 'no') !== FALSE ) {
236
+        } else if ( stripos($vote, 'no') !== false ) {
237 237
             $scores['no'] = $agree;
238 238
             $scores['aye'] = 0;
239 239
         } else {
Please login to merge, or discard this patch.
classes/Office.php 4 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
     public $source;
20 20
 
21 21
     /**
22
-    * To String
23
-    *
24
-    * Return the office title as a string.
25
-    *
26
-    * @return string The title of the office, or "Unnamed Office"
27
-    */
22
+     * To String
23
+     *
24
+     * Return the office title as a string.
25
+     *
26
+     * @return string The title of the office, or "Unnamed Office"
27
+     */
28 28
 
29 29
     public function __toString() {
30 30
         if (isset ($this->title)){
@@ -35,25 +35,25 @@  discard block
 block discarded – undo
35 35
     }
36 36
 
37 37
     /**
38
-    * Pretty Dates
39
-    *
40
-    * Return a string containing prettified dates of this office.
41
-    *
42
-    * 2004-05-28 and 2004-05-13 are the first dates for data scraped from the
43
-    * old selctee/privsec pages on parliament.uk (you can see this in
44
-    * cmpages/chgpages' privsec0001_2004-06-08.html and
45
-    * selctee0001_2004-06-08.html). So if the date is those dates for those two
46
-    * things, you don't want to display it because it's not a known start date,
47
-    * it could have been before that date. 2005-11-10 is because the PPS changes
48
-    * did not all happen on that date but the website did not update until that
49
-    * date so it outputs "before" in either from/to date in that case.
50
-    * 2009-01-16 is the last date before the page disappeared off parliament.uk
51
-    * entirely so that displays that fact that after then we don't know.
52
-    *
53
-    * @todo https://github.com/mysociety/theyworkforyou/issues/632
54
-    *
55
-    * @return string The dates of this office in a readable form.
56
-    */
38
+     * Pretty Dates
39
+     *
40
+     * Return a string containing prettified dates of this office.
41
+     *
42
+     * 2004-05-28 and 2004-05-13 are the first dates for data scraped from the
43
+     * old selctee/privsec pages on parliament.uk (you can see this in
44
+     * cmpages/chgpages' privsec0001_2004-06-08.html and
45
+     * selctee0001_2004-06-08.html). So if the date is those dates for those two
46
+     * things, you don't want to display it because it's not a known start date,
47
+     * it could have been before that date. 2005-11-10 is because the PPS changes
48
+     * did not all happen on that date but the website did not update until that
49
+     * date so it outputs "before" in either from/to date in that case.
50
+     * 2009-01-16 is the last date before the page disappeared off parliament.uk
51
+     * entirely so that displays that fact that after then we don't know.
52
+     *
53
+     * @todo https://github.com/mysociety/theyworkforyou/issues/632
54
+     *
55
+     * @return string The dates of this office in a readable form.
56
+     */
57 57
 
58 58
     public function pretty_dates() {
59 59
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
         $output = '';
65 65
 
66 66
         if (
67
-            !($this->source == 'chgpages/selctee' && $this->from_date == '2004-05-28') AND
67
+            !($this->source == 'chgpages/selctee' && $this->from_date == '2004-05-28') and
68 68
             !($this->source == 'chgpages/privsec' && $this->from_date == '2004-05-13')
69 69
         ) {
70 70
             if ($this->source == 'chgpages/privsec' && $this->from_date == '2005-11-10') {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     */
28 28
 
29 29
     public function __toString() {
30
-        if (isset ($this->title)){
30
+        if (isset ($this->title)) {
31 31
             return (string) $this->title;
32 32
         } else {
33 33
             return 'Unnamed Office';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             if ($this->source == 'chgpages/privsec' && $this->from_date == '2005-11-10') {
71 71
                 $output .= 'before ';
72 72
             }
73
-            $output .= format_date($this->from_date,SHORTDATEFORMAT) . ' ';
73
+            $output .= format_date($this->from_date, SHORTDATEFORMAT) . ' ';
74 74
         }
75 75
 
76 76
         $output .= 'to ';
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     */
28 28
 
29 29
     public function __toString() {
30
-        if (isset ($this->title)){
30
+        if (isset ($this->title)) {
31 31
             return (string) $this->title;
32 32
         } else {
33 33
             return 'Unnamed Office';
Please login to merge, or discard this patch.
classes/Search/Normal.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,9 @@
 block discarded – undo
141 141
 
142 142
     private function find_members() {
143 143
         $searchstring = trim(preg_replace('#-?[a-z]+:[a-z0-9]+#', '', $this->searchstring));
144
-        if (!$searchstring) return array();
144
+        if (!$searchstring) {
145
+            return array();
146
+        }
145 147
 
146 148
         $members = array();
147 149
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -188,6 +188,9 @@
 block discarded – undo
188 188
         return $items;
189 189
     }
190 190
 
191
+    /**
192
+     * @param \MySociety\TheyWorkForYou\Url $url
193
+     */
191 194
     private function generate_pagination_links($data, $url, $first, $last) {
192 195
         $links = array();
193 196
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
         }
13 13
 
14 14
         $o = get_http_var('o');
15
-        $args = array (
15
+        $args = array(
16 16
             's' => $this->searchstring,
17 17
             'p' => $pagenum,
18 18
             'num' => get_http_var('num'),
19 19
             'pop' => get_http_var('pop'),
20
-            'o' => ($o=='d' || $o=='r' || $o=='o') ? $o : 'd',
20
+            'o' => ($o == 'd' || $o == 'r' || $o == 'o') ? $o : 'd',
21 21
         );
22 22
 
23 23
         return $args;
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
         }
56 56
 
57 57
         $sort_order = 'newest';
58
-        if ( $args['o'] == 'o' ) {
58
+        if ($args['o'] == 'o') {
59 59
             $sort_order = 'oldest';
60
-        } else if ( $args['o'] == 'r' ) {
60
+        } else if ($args['o'] == 'r') {
61 61
             $sort_order = 'relevance';
62 62
         }
63 63
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             return array('error' => $SEARCHENGINE->error);
74 74
         } else {
75 75
             $LIST = new \HANSARDLIST();
76
-            $data = $LIST->display('search', $args , 'none');
76
+            $data = $LIST->display('search', $args, 'none');
77 77
             $data['search_type'] = 'normal';
78 78
             $data['sort_order'] = $sort_order;
79 79
             $data['members'] = $members;
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
             return false;
94 94
         }
95 95
 
96
-        list ($constituencies, ) = \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery($searchterm);
96
+        list ($constituencies,) = \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery($searchterm);
97 97
 
98 98
         $constituency = "";
99
-        if (count($constituencies)==1) {
99
+        if (count($constituencies) == 1) {
100 100
             $constituency = $constituencies[0];
101 101
         }
102 102
 
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 
113 113
                 $MEMBER = new \MySociety\TheyWorkForYou\Member(array('constituency'=>$constituency, 'house' => 1));
114 114
                 $cons[] = $MEMBER;
115
-                if ( $MEMBER->current_member(1) ) {
115
+                if ($MEMBER->current_member(1)) {
116 116
                     $mp_types['mp']++;
117 117
                 } else {
118 118
                     $mp_types['former']++;
119 119
                 }
120
-            } catch ( \MySociety\TheyWorkForYou\MemberException $e ) {
120
+            } catch (\MySociety\TheyWorkForYou\MemberException $e) {
121 121
                 $cons = array();
122 122
             }
123 123
         } elseif (count($constituencies)) {
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
                 try {
126 126
                     $MEMBER = new \MySociety\TheyWorkForYou\Member(array('constituency'=>$constituency, 'house' => 1));
127 127
                     $cons[] = $MEMBER;
128
-                    if ( $MEMBER->current_member(1) ) {
128
+                    if ($MEMBER->current_member(1)) {
129 129
                         $mp_types['mp']++;
130 130
                     } else {
131 131
                         $mp_types['former']++;
132 132
                     }
133
-                } catch ( \MySociety\TheyWorkForYou\MemberException $e ) {
133
+                } catch (\MySociety\TheyWorkForYou\MemberException $e) {
134 134
                     continue;
135 135
                 }
136 136
             }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
         $q = \MySociety\TheyWorkForYou\Utility\Search::searchMemberDbLookup($searchstring);
149 149
         $row_count = $q->rows();
150
-        for ($n=0; $n<$row_count; $n++) {
150
+        for ($n = 0; $n < $row_count; $n++) {
151 151
             $members[] = $q->field($n, 'person_id');
152 152
         }
153 153
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         $q = $db->query("SELECT person FROM moffice WHERE position LIKE :pos ORDER BY from_date DESC, moffice_id",
156 156
             array('pos' => "%$searchstring%"));
157 157
         $row_count = $q->rows();
158
-        for ($n=0; $n<$row_count; $n++) {
158
+        for ($n = 0; $n < $row_count; $n++) {
159 159
             $members[] = $q->field($n, 'person');
160 160
         }
161 161
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             $link = array(
204 204
                 'url' => $url->generate(),
205 205
                 'page' => $n,
206
-                'current' => ( $n == $data['page'] )
206
+                'current' => ($n == $data['page'])
207 207
             );
208 208
 
209 209
             $links[] = $link;
@@ -244,27 +244,27 @@  discard block
 block discarded – undo
244 244
             $numlinks = $this->generate_pagination_links($data, $URL, $firstpage, $lastpage);
245 245
 
246 246
             $pagelinks['nums'] = $numlinks;
247
-            $pagelinks['first_result'] = $page == 1 ? 1 : ( ( $page - 1 ) * $results_per_page ) + 1;
248
-            $pagelinks['last_result'] = $page == $numpages ? $total_results : $pagelinks['first_result'] + ( $results_per_page - 1 );
247
+            $pagelinks['first_result'] = $page == 1 ? 1 : (($page - 1) * $results_per_page) + 1;
248
+            $pagelinks['last_result'] = $page == $numpages ? $total_results : $pagelinks['first_result'] + ($results_per_page - 1);
249 249
 
250
-            if ( $page != 1 ) {
250
+            if ($page != 1) {
251 251
                 $prev_page = $page - 1;
252
-                $URL->insert(array( 'p' => $prev_page ) );
252
+                $URL->insert(array('p' => $prev_page));
253 253
                 $pagelinks['prev'] = array(
254 254
                     'url' => $URL->generate()
255 255
                 );
256
-                $URL->insert(array( 'p' => 1 ) );
256
+                $URL->insert(array('p' => 1));
257 257
                 $pagelinks['firstpage'] = array(
258 258
                     'url' => $URL->generate()
259 259
                 );
260 260
             }
261 261
             if ($page != $numpages) {
262 262
                 $next_page = $page + 1;
263
-                $URL->insert(array( 'p' => $next_page ) );
263
+                $URL->insert(array('p' => $next_page));
264 264
                 $pagelinks['next'] = array(
265 265
                     'url' => $URL->generate()
266 266
                 );
267
-                $URL->insert(array( 'p' => $numpages ) );
267
+                $URL->insert(array('p' => $numpages));
268 268
                 $pagelinks['lastpage'] = array(
269 269
                     'url' => $URL->generate()
270 270
                 );
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
         $links['rss'] = $DATA->page_metadata($this_page, 'rss');
282 282
 
283 283
         if ($SEARCHENGINE) {
284
-            $links['email'] = '/alert/?' . ($this->searchstring ? 'alertsearch='.urlencode($this->searchstring) : '');
284
+            $links['email'] = '/alert/?' . ($this->searchstring ? 'alertsearch=' . urlencode($this->searchstring) : '');
285 285
             $links['email_desc'] = $SEARCHENGINE->query_description_long();
286 286
         }
287 287
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             $search_engine = new \SEARCHENGINE($filter_ss);
296 296
             $links['email_section'] = $links['email'];
297 297
             $links['email_desc_section'] = $links['email_desc'];
298
-            $links['email'] = '/alert/?' . ($filter_ss ? 'alertsearch='.urlencode($filter_ss) : '');
298
+            $links['email'] = '/alert/?' . ($filter_ss ? 'alertsearch=' . urlencode($filter_ss) : '');
299 299
             $links['email_desc'] = $search_engine->query_description_long();
300 300
         }
301 301
 
Please login to merge, or discard this patch.
classes/Search/ParseArgs.php 2 patches
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,11 +28,17 @@  discard block
 block discarded – undo
28 28
 
29 29
         if (get_http_var('from') || get_http_var('to')) {
30 30
             $from = parse_date(get_http_var('from'));
31
-            if ($from) $from = $from['iso'];
32
-            else $from = '1935-10-01';
31
+            if ($from) {
32
+                $from = $from['iso'];
33
+            } else {
34
+                $from = '1935-10-01';
35
+            }
33 36
             $to = parse_date(get_http_var('to'));
34
-            if ($to) $to = $to['iso'];
35
-            else $to = date('Y-m-d');
37
+            if ($to) {
38
+                $to = $to['iso'];
39
+            } else {
40
+                $to = date('Y-m-d');
41
+            }
36 42
             $searchstring .= " $from..$to";
37 43
         }
38 44
 
@@ -105,8 +111,10 @@  discard block
 block discarded – undo
105 111
         }
106 112
 
107 113
         $advsection = get_http_var('section');
108
-        if (!$advsection)
109
-            $advsection = get_http_var('maj'); # Old URLs had this
114
+        if (!$advsection) {
115
+                    $advsection = get_http_var('maj');
116
+        }
117
+        # Old URLs had this
110 118
         if (is_array($advsection)) {
111 119
             $searchstring .= ' section:' . join(' section:', $advsection);
112 120
         } elseif ($advsection) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
             $q = \MySociety\TheyWorkForYou\Utility\Search::searchMemberDbLookup($searchspeaker);
82 82
             $pids = array();
83 83
             $row_count = $q->rows();
84
-            for ($i=0; $i<$row_count; $i++) {
84
+            for ($i = 0; $i < $row_count; $i++) {
85 85
                 $pids[$q->field($i, 'person_id')] = true;
86 86
             }
87 87
             $pids = array_keys($pids);
Please login to merge, or discard this patch.
classes/Topic.php 3 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $this->db = new \ParlDB;
34 34
 
35 35
         if (is_null($data)) {
36
-          return;
36
+            return;
37 37
         }
38 38
 
39 39
         $this->id = $data['id'];
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
     private function _getContentIDs() {
126 126
         $q = $this->db->query(
127
-          "SELECT body, gid, ep.epobject_id FROM epobject ep
127
+            "SELECT body, gid, ep.epobject_id FROM epobject ep
128 128
            JOIN hansard h on ep.epobject_id = h.epobject_id
129 129
            JOIN topic_epobjects te on te.epobject_id = ep.epobject_id
130 130
            WHERE topic_key = :topic_key",
@@ -180,24 +180,24 @@  discard block
 block discarded – undo
180 180
 
181 181
     function addContent($gid) {
182 182
         $q = $this->db->query(
183
-          "SELECT epobject_id FROM hansard WHERE gid = :gid",
184
-          array(
183
+            "SELECT epobject_id FROM hansard WHERE gid = :gid",
184
+            array(
185 185
             ":gid" => $gid
186
-          )
186
+            )
187 187
         );
188 188
 
189 189
         if (!$q->success() || $q->rows == 0) {
190
-          return false;
190
+            return false;
191 191
         }
192 192
 
193 193
         $epobject_id = $q->field(0, 'epobject_id');
194 194
 
195 195
         $q = $this->db->query(
196
-          "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)",
197
-          array(
196
+            "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)",
197
+            array(
198 198
             ":topic" => $this->id,
199 199
             ":ep_id" => $epobject_id
200
-          )
200
+            )
201 201
         );
202 202
 
203 203
         return $q->success();
@@ -205,31 +205,31 @@  discard block
 block discarded – undo
205 205
 
206 206
     function deleteContent($id) {
207 207
         $q = $this->db->query(
208
-          "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id",
209
-          array(
208
+            "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id",
209
+            array(
210 210
             ":topic" => $this->id,
211 211
             ":ep_id" => $id
212
-          )
212
+            )
213 213
         );
214 214
 
215 215
         return $q->success();
216 216
     }
217 217
 
218 218
     function getPolicySets() {
219
-      $q = $this->db->query(
219
+        $q = $this->db->query(
220 220
         "SELECT policyset FROM topic_policysets WHERE topic_key = :key",
221 221
         array(
222
-          ':key' => $this->id
222
+            ':key' => $this->id
223 223
         )
224
-      );
224
+        );
225 225
 
226
-      $sets = array();
227
-      $count = $q->rows;
228
-      for ($i = 0; $i < $count; $i++) {
226
+        $sets = array();
227
+        $count = $q->rows;
228
+        for ($i = 0; $i < $count; $i++) {
229 229
         $sets[] = $q->field($i, 'policyset');
230
-      }
230
+        }
231 231
 
232
-      return $sets;
232
+        return $sets;
233 233
     }
234 234
 
235 235
     function addPolicySets($sets) {
@@ -259,20 +259,20 @@  discard block
 block discarded – undo
259 259
     }
260 260
 
261 261
     function getPolicies() {
262
-      $q = $this->db->query(
262
+        $q = $this->db->query(
263 263
         'SELECT policy_id FROM topic_policies WHERE topic_key = :key',
264 264
         array(
265
-          ':key' => $this->id
265
+            ':key' => $this->id
266 266
         )
267
-      );
267
+        );
268 268
 
269
-      $policies = array();
270
-      $count = $q->rows;
271
-      for ($i = 0; $i < $count; $i++) {
269
+        $policies = array();
270
+        $count = $q->rows;
271
+        for ($i = 0; $i < $count; $i++) {
272 272
         $policies[] = $q->field($i, 'policy_id');
273
-      }
273
+        }
274 274
 
275
-      return $policies;
275
+        return $policies;
276 276
     }
277 277
 
278 278
     function addPolicies($policies) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
     function save() {
318 318
         $q = $this->db->query(
319
-          "REPLACE INTO topics
319
+            "REPLACE INTO topics
320 320
           (id, title, slug, description, search_string, front_page, image)
321 321
           VALUES
322 322
           (:id, :title, :slug, :description, :search_string, :front_page, :image)",
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      *
29 29
      */
30 30
 
31
-    public function __construct($data = NULL)
31
+    public function __construct($data = null)
32 32
     {
33 33
         $this->db = new \ParlDB;
34 34
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     function sctitle() {
55 55
         $title = $this->title;
56
-        if (strpos($title, 'The ') === 0 ) {
56
+        if (strpos($title, 'The ') === 0) {
57 57
             $title = lcfirst($title);
58 58
         }
59 59
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             );
243 243
         } else {
244 244
             foreach ($sets as $set) {
245
-                if ($set == '' ) {
245
+                if ($set == '') {
246 246
                     continue;
247 247
                 }
248 248
                 $q = $this->db->query(
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             );
286 286
         } else {
287 287
             foreach ($policies as $policy) {
288
-                if ($policy == '' ) {
288
+                if ($policy == '') {
289 289
                     continue;
290 290
                 }
291 291
                 $q = $this->db->query(
Please login to merge, or discard this patch.
classes/SectionView/SpView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
     protected function getSearchSections() {
26 26
         return array(
27
-            array( 'section' => 'sp' )
27
+            array('section' => 'sp')
28 28
         );
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
classes/SectionView/WransView.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
 
13 13
     protected function display_front() {
14 14
         global $DATA, $this_page;
15
-        if ( get_http_var('type') == 'wrans') {
15
+        if (get_http_var('type') == 'wrans') {
16 16
             return parent::display_front();
17 17
         }
18 18
 
19 19
         $data = array();
20 20
 
21
-        $args = array( 'months' => 1 );
21
+        $args = array('months' => 1);
22 22
         $WRANSLIST = new \WRANSLIST;
23 23
 
24 24
         $wrans = array();
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 
51 51
     protected function getSearchSections() {
52 52
         $sections = array(
53
-            array( 'section' => 'wrans', 'title' => 'Written Answers' ),
53
+            array('section' => 'wrans', 'title' => 'Written Answers'),
54 54
         );
55
-        if ( get_http_var('type') == '') {
56
-            $sections[] = array( 'section' => 'wms', 'title' => 'Written Ministerial Statements' );
55
+        if (get_http_var('type') == '') {
56
+            $sections[] = array('section' => 'wms', 'title' => 'Written Ministerial Statements');
57 57
         }
58 58
         return $sections;
59 59
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     # speech bar the first (assuming that's the question)
63 63
     private $votelinks_so_far = 0;
64 64
 
65
-    protected function generate_votes ($votes, $id, $gid) {
65
+    protected function generate_votes($votes, $id, $gid) {
66 66
         /*
67 67
         Returns HTML for the 'Does this answer the question?' links (wrans) in the sidebar.
68 68
         $votes = => array (
Please login to merge, or discard this patch.
classes/SectionView/DebatesView.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@  discard block
 block discarded – undo
66 66
     private $first_gid = '';
67 67
 
68 68
     protected function get_video_html($row, $heading_hpos, $speeches) {
69
-        if (!$this->first_gid) $this->first_gid = $row['gid'];
69
+        if (!$this->first_gid) {
70
+            $this->first_gid = $row['gid'];
71
+        }
70 72
 
71 73
         $video_content = '';
72 74
         if (!$this->first_video_displayed && $row['video_status']&4 && !($row['video_status']&8)) {
@@ -97,7 +99,9 @@  discard block
 block discarded – undo
97 99
         $adate = $vq->field(0, 'adate');
98 100
         $time = $vq->field(0, 'atime');
99 101
         $videodb = \MySociety\TheyWorkForYou\Utility\Video::dbConnect();
100
-        if (!$videodb) return '';
102
+        if (!$videodb) {
103
+            return '';
104
+        }
101 105
         $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $adate, $time);
102 106
         $start = $video['offset'];
103 107
         $out = '';
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         $DEBATELIST = new \DEBATELIST;
17 17
         $debates = array();
18 18
         $debates['data'] = $DEBATELIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none');
19
-        $args = array( 'months' => 1 );
19
+        $args = array('months' => 1);
20 20
         $debates['calendar'] = $DEBATELIST->display('calendar', $args, 'none');
21 21
         $debates['rssurl'] = $DATA->page_metadata($this_page, 'rss');
22 22
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
         $WHALLLIST = new \WHALLLIST;
28 28
         $whall['data'] = $WHALLLIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none');
29
-        $args = array( 'months' => 1 );
29
+        $args = array('months' => 1);
30 30
         $whall['calendar'] = $WHALLLIST->display('calendar', $args, 'none');
31 31
         $whall['rssurl'] = $DATA->page_metadata($this_page, 'rss');
32 32
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         $LORDSDEBATELIST = new \LORDSDEBATELIST;
38 38
         $lords['data'] = $LORDSDEBATELIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none');
39
-        $args = array( 'months' => 1 );
39
+        $args = array('months' => 1);
40 40
         $lords['calendar'] = $LORDSDEBATELIST->display('calendar', $args, 'none');
41 41
 
42 42
         $lords['rssurl'] = $DATA->page_metadata($this_page, 'rss');
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 
56 56
     protected function getSearchSections() {
57 57
         return array(
58
-            array( 'section' => 'debates', 'title' => 'House of Commons' ),
59
-            array( 'section' => 'lords', 'title' => 'House of Lords' ),
60
-            array( 'section' => 'whall', 'title' => 'Westminster Hall' )
58
+            array('section' => 'debates', 'title' => 'House of Commons'),
59
+            array('section' => 'lords', 'title' => 'House of Lords'),
60
+            array('section' => 'whall', 'title' => 'Westminster Hall')
61 61
         );
62 62
     }
63 63
 
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
         if (!$this->first_gid) $this->first_gid = $row['gid'];
70 70
 
71 71
         $video_content = '';
72
-        if (!$this->first_video_displayed && $row['video_status']&4 && !($row['video_status']&8)) {
72
+        if (!$this->first_video_displayed && $row['video_status'] & 4 && !($row['video_status'] & 8)) {
73 73
             $video_content = $this->video_sidebar($row, $heading_hpos, $speeches);
74 74
             $this->first_video_displayed = true;
75 75
         }
76
-        if (!$video_content && !$this->first_speech_displayed && $row['video_status']&1 && !($row['video_status']&12)) {
76
+        if (!$video_content && !$this->first_speech_displayed && $row['video_status'] & 1 && !($row['video_status'] & 12)) {
77 77
             $video_content = $this->video_advert($row);
78 78
             $this->first_speech_displayed = true;
79 79
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         if ($count > 1) {
105 105
             $out .= '<div class="debate__video" id="video_wrap"><div>';
106 106
             if ($row['gid'] != $this->first_gid) {
107
-                $out .= '<p class="video-instructions">This video starts around ' . ($row['hpos']-$heading_hpos) . ' speeches in (<a href="#g' . gid_to_anchor($row['gid']) . '">move there in text</a>)</p>';
107
+                $out .= '<p class="video-instructions">This video starts around ' . ($row['hpos'] - $heading_hpos) . ' speeches in (<a href="#g' . gid_to_anchor($row['gid']) . '">move there in text</a>)</p>';
108 108
             }
109 109
         }
110 110
         $out .= \MySociety\TheyWorkForYou\Utility\Video::object($video['id'], $start, "$gid_type/$row[gid]");
Please login to merge, or discard this patch.