Passed
Push — master ( 0643ea...01e983 )
by Struan
04:28
created
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/Utility/Video.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
     }
20 20
 
21 21
     public static function fromTimestamp($videodb, $date, $time) {
22
-        if (!$videodb) return null;
22
+        if (!$videodb) {
23
+            return null;
24
+        }
23 25
         date_default_timezone_set('Europe/London');
24 26
         $epoch = strtotime("$date $time");
25 27
         $timestamp = gmdate('c', $epoch);
@@ -38,9 +40,13 @@  discard block
 block discarded – undo
38 40
 
39 41
     public static function object($video_id, $start, $gid, $stamping = '', $pid = 0) {
40 42
         $flashvars = "gid=$gid&file=$video_id&start=$start";
41
-        if ($stamping) $flashvars .= '&stamping=1';
42
-        if ($pid) $flashvars .= '&pid=' . $pid;
43
-/*
43
+        if ($stamping) {
44
+            $flashvars .= '&stamping=1';
45
+        }
46
+        if ($pid) {
47
+            $flashvars .= '&pid=' . $pid;
48
+        }
49
+        /*
44 50
 <object width='360' height='300'
45 51
     classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
46 52
     codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 {
13 13
 
14 14
     public static function dbConnect() {
15
-        $connstr = 'host='.OPTION_BBC_DB_HOST.' port='.OPTION_BBC_DB_PORT.' dbname='.OPTION_BBC_DB_NAME.' user='.OPTION_BBC_DB_USER.' password='.OPTION_BBC_DB_PASS;
15
+        $connstr = 'host=' . OPTION_BBC_DB_HOST . ' port=' . OPTION_BBC_DB_PORT . ' dbname=' . OPTION_BBC_DB_NAME . ' user=' . OPTION_BBC_DB_USER . ' password=' . OPTION_BBC_DB_PASS;
16 16
         $videodb = pg_connect($connstr);
17 17
 
18 18
         return $videodb;
Please login to merge, or discard this patch.
classes/Policies.php 4 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     }
310 310
 
311 311
     public function getSetDescriptions() {
312
-      return $this->set_descs;
312
+        return $this->set_descs;
313 313
     }
314 314
 
315 315
     /**
@@ -397,18 +397,18 @@  discard block
 block discarded – undo
397 397
     }
398 398
 
399 399
     public function limitToArray($policies) {
400
-          $out = array();
401
-          // Reassemble the new policies list based on the set.
402
-          foreach ($policies as $policy) {
403
-              if (isset($this->policies[$policy])) {
404
-                  $out[$policy] = $this->policies[$policy];
405
-              }
406
-          }
407
-
408
-          $new_policies = new self();
409
-          $new_policies->policies = $out;
410
-
411
-          return $new_policies;
400
+            $out = array();
401
+            // Reassemble the new policies list based on the set.
402
+            foreach ($policies as $policy) {
403
+                if (isset($this->policies[$policy])) {
404
+                    $out[$policy] = $this->policies[$policy];
405
+                }
406
+            }
407
+
408
+            $new_policies = new self();
409
+            $new_policies->policies = $out;
410
+
411
+            return $new_policies;
412 412
     }
413 413
 
414 414
     public function getPolicyDetails($policyID) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -293,7 +293,7 @@
 block discarded – undo
293 293
 
294 294
     private $policy_id;
295 295
 
296
-    public function __construct($policy_id = NULL) {
296
+    public function __construct($policy_id = null) {
297 297
         $this->db = new \ParlDB;
298 298
 
299 299
         if ( $policy_id ) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -366,14 +366,12 @@
 block discarded – undo
366 366
     public function limitToSet($set) {
367 367
 
368 368
         // Sanity check the set exists
369
-        if (isset($this->sets[$set]))
370
-        {
369
+        if (isset($this->sets[$set])) {
371 370
             $out = array();
372 371
             // Reassemble the new policies list based on the set.
373 372
             foreach ($this->sets[$set] as $set_policy)
374 373
             {
375
-                if (isset($this->policies[$set_policy]))
376
-                {
374
+                if (isset($this->policies[$set_policy])) {
377 375
                     $out[$set_policy] = $this->policies[$set_policy];
378 376
                 } else {
379 377
                     // if we've limited the policies to a single one then we only
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     public function __construct($policy_id = NULL) {
303 303
         $this->db = new \ParlDB;
304 304
 
305
-        if ( $policy_id ) {
305
+        if ($policy_id) {
306 306
             $this->policy_id = $policy_id;
307 307
             $this->policies = array(
308 308
                 $policy_id => $this->policies[$policy_id]
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
                     // want to complain here if we're looking for that policy and
381 381
                     // it does not exist. Otherwise, if the single policy isn't in
382 382
                     // the set we want to return an empty set
383
-                    if ( !isset($this->policy_id) || $set_policy == $this->policy_id ) {
384
-                        throw new \Exception ('Policy ' . $set_policy . ' in set "' . $set . '" does not exist.');
383
+                    if (!isset($this->policy_id) || $set_policy == $this->policy_id) {
384
+                        throw new \Exception('Policy ' . $set_policy . ' in set "' . $set . '" does not exist.');
385 385
                     }
386 386
                 }
387 387
             }
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
             return $new_policies->shuffle();
393 393
 
394 394
         } else {
395
-            throw new \Exception ('Policy set "' . $set . '" does not exist.');
395
+            throw new \Exception('Policy set "' . $set . '" does not exist.');
396 396
         }
397 397
     }
398 398
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 
434 434
         $image = $q['image'];
435 435
 
436
-        if ( $image && file_exists(BASEDIR . '/' . $image)) {
436
+        if ($image && file_exists(BASEDIR . '/' . $image)) {
437 437
             $props['image'] = $image;
438 438
             $props['image_license'] = $q['image_license'];
439 439
             $props['image_attribution'] = $q['image_attrib'];
Please login to merge, or discard this patch.
classes/Member.php 3 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
     }
134 134
 
135 135
     /**
136
-    * Image
137
-    *
138
-    * Return a URL for the member's image.
139
-    *
140
-    * @return string The URL of the member's image.
141
-    */
136
+     * Image
137
+     *
138
+     * Return a URL for the member's image.
139
+     *
140
+     * @return string The URL of the member's image.
141
+     */
142 142
 
143 143
     public function image() {
144 144
 
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
     }
208 208
 
209 209
     /**
210
-    * Offices
211
-    *
212
-    * Return an array of Office objects held (or previously held) by the member.
213
-    *
214
-    * @param string $include_only  Restrict the list to include only "previous" or "current" offices.
215
-    * @param bool   $ignore_committees Ignore offices that appear to be committee memberships.
216
-    *
217
-    * @return array An array of Office objects.
218
-    */
210
+     * Offices
211
+     *
212
+     * Return an array of Office objects held (or previously held) by the member.
213
+     *
214
+     * @param string $include_only  Restrict the list to include only "previous" or "current" offices.
215
+     * @param bool   $ignore_committees Ignore offices that appear to be committee memberships.
216
+     *
217
+     * @return array An array of Office objects.
218
+     */
219 219
 
220 220
     public function offices($include_only = NULL, $ignore_committees = FALSE) {
221 221
 
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
     }
270 270
 
271 271
     /**
272
-    * Get Other Parties String
273
-    *
274
-    * Return a readable list of party changes for this member.
275
-    *
276
-    * @return string|null A readable list of the party changes for this member.
277
-    */
272
+     * Get Other Parties String
273
+     *
274
+     * Return a readable list of party changes for this member.
275
+     *
276
+     * @return string|null A readable list of the party changes for this member.
277
+     */
278 278
 
279 279
     public function getOtherPartiesString() {
280 280
 
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
     }
303 303
 
304 304
     /**
305
-    * Get Other Constituencies String
306
-    *
307
-    * Return a readable list of other constituencies for this member.
308
-    *
309
-    * @return string|null A readable list of the other constituencies for this member.
310
-    */
305
+     * Get Other Constituencies String
306
+     *
307
+     * Return a readable list of other constituencies for this member.
308
+     *
309
+     * @return string|null A readable list of the other constituencies for this member.
310
+     */
311 311
 
312 312
     public function getOtherConstituenciesString() {
313 313
 
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
     }
321 321
 
322 322
     /**
323
-    * Get Entered/Left Strings
324
-    *
325
-    * Return an array of readable strings covering when people entered or left
326
-    * various houses. Returns an array since it's possible for a member to have
327
-    * done several of these things.
328
-    *
329
-    * @return array An array of strings of when this member entered or left houses.
330
-    */
323
+     * Get Entered/Left Strings
324
+     *
325
+     * Return an array of readable strings covering when people entered or left
326
+     * various houses. Returns an array since it's possible for a member to have
327
+     * done several of these things.
328
+     *
329
+     * @return array An array of strings of when this member entered or left houses.
330
+     */
331 331
     public function getEnterLeaveStrings() {
332 332
         $output = array();
333 333
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 
40 40
             foreach ($house_types as $house_type) {
41 41
 
42
-                if (in_array($house_type, $left_house) AND
43
-                    $left_house[$house_type]['reason'] AND
42
+                if (in_array($house_type, $left_house) and
43
+                    $left_house[$house_type]['reason'] and
44 44
                     $left_house[$house_type]['reason'] == 'Died'
45 45
                 ) {
46 46
 
47 47
                     // This member has left a house because of death.
48
-                    return TRUE;
48
+                    return true;
49 49
                 }
50 50
 
51 51
             }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
         // If we get this far the member hasn't left a house due to death, and
56 56
         // is presumably alive.
57
-        return FALSE;
57
+        return false;
58 58
 
59 59
     }
60 60
 
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 
77 77
             $diff = $date_entered->diff($now);
78 78
             if ( $diff->y == 0 && $diff->m <= 6 ) {
79
-                return TRUE;
79
+                return true;
80 80
             }
81 81
         }
82 82
 
83
-        return FALSE;
83
+        return false;
84 84
     }
85 85
 
86 86
     /*
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             return $this->extra_info()['eu_ref_stance'];
130 130
         }
131 131
 
132
-        return FALSE;
132
+        return false;
133 133
     }
134 134
 
135 135
     /**
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
         }
151 151
 
152 152
         // We can determine if the image exists or not by testing if size is set
153
-        if ($size !== NULL) {
154
-            $exists = TRUE;
153
+        if ($size !== null) {
154
+            $exists = true;
155 155
         } else {
156
-            $exists = FALSE;
156
+            $exists = false;
157 157
         }
158 158
 
159 159
         return array(
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     * @return array An array of Office objects.
218 218
     */
219 219
 
220
-    public function offices($include_only = NULL, $ignore_committees = FALSE) {
220
+    public function offices($include_only = null, $ignore_committees = false) {
221 221
 
222 222
         $out = array();
223 223
 
@@ -253,16 +253,16 @@  discard block
 block discarded – undo
253 253
     }
254 254
 
255 255
     private function includeOffice($include_only, $to_date) {
256
-        $include_office = TRUE;
256
+        $include_office = true;
257 257
 
258 258
         // If we should only include previous offices, and the to date is in the future, suppress this office.
259
-        if ($include_only == 'previous' AND $to_date == '9999-12-31') {
260
-            $include_office = FALSE;
259
+        if ($include_only == 'previous' and $to_date == '9999-12-31') {
260
+            $include_office = false;
261 261
         }
262 262
 
263 263
         // If we should only include previous offices, and the to date is in the past, suppress this office.
264
-        if ($include_only == 'current' AND $to_date != '9999-12-31') {
265
-            $include_office = FALSE;
264
+        if ($include_only == 'current' and $to_date != '9999-12-31') {
265
+            $include_office = false;
266 266
         }
267 267
 
268 268
         return $include_office;
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             $output .= join('; ', $other_parties);
288 288
             return $output;
289 289
         } else {
290
-            return NULL;
290
+            return null;
291 291
         }
292 292
 
293 293
     }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         if ($this->other_constituencies) {
315 315
             return 'Also represented ' . join('; ', array_keys($this->other_constituencies));
316 316
         } else {
317
-            return NULL;
317
+            return null;
318 318
         }
319 319
 
320 320
     }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             $now = new \DateTime();
77 77
 
78 78
             $diff = $date_entered->diff($now);
79
-            if ( $diff->y == 0 && $diff->m <= 6 ) {
79
+            if ($diff->y == 0 && $diff->m <= 6) {
80 80
                 return TRUE;
81 81
             }
82 82
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
         $entered_house = $this->entered_house($house);
99 99
 
100
-        if ( $entered_house ) {
100
+        if ($entered_house) {
101 101
             $date_entered = $entered_house['date'];
102 102
         }
103 103
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
         $left_house = $this->left_house($house);
119 119
 
120
-        if ( $left_house ) {
120
+        if ($left_house) {
121 121
             $date_left = $left_house['date'];
122 122
         }
123 123
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 
146 146
         $is_lord = $this->house(HOUSE_TYPE_LORDS);
147 147
         if ($is_lord) {
148
-            list($image,$size) = Utility\Member::findMemberImage($this->person_id(), false, 'lord');
148
+            list($image, $size) = Utility\Member::findMemberImage($this->person_id(), false, 'lord');
149 149
         } else {
150
-            list($image,$size) = Utility\Member::findMemberImage($this->person_id(), false, true);
150
+            list($image, $size) = Utility\Member::findMemberImage($this->person_id(), false, true);
151 151
         }
152 152
 
153 153
         // We can determine if the image exists or not by testing if size is set
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 
171 171
         usort(
172 172
             $departures,
173
-            function ($a, $b) {
174
-                if ( $a['date'] == $b['date'] ) {
173
+            function($a, $b) {
174
+                if ($a['date'] == $b['date']) {
175 175
                     return 0;
176
-                } else if ( $a['date'] < $b['date'] ) {
176
+                } else if ($a['date'] < $b['date']) {
177 177
                     return -1;
178 178
                 } else {
179 179
                     return 1;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $office = $office['office'];
212 212
 
213 213
             foreach ($office as $row) {
214
-                if ( $officeObject = $this->getOfficeObject($include_only, $ignore_committees, $row) ) {
214
+                if ($officeObject = $this->getOfficeObject($include_only, $ignore_committees, $row)) {
215 215
                     $out[] = $officeObject;
216 216
                 }
217 217
             }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     private function entered_house_line($house, $house_name) {
349 349
         if (isset($this->entered_house[$house]['date'])) {
350 350
             $string = "<strong>Entered the $house_name ";
351
-            $string .= strlen($this->entered_house[$house]['date_pretty'])==HOUSE_TYPE_SCOTLAND ? 'in ' : 'on ';
351
+            $string .= strlen($this->entered_house[$house]['date_pretty']) == HOUSE_TYPE_SCOTLAND ? 'in ' : 'on ';
352 352
             $string .= $this->entered_house[$house]['date_pretty'] . '</strong>';
353 353
             if ($this->entered_house[$house]['reason']) {
354 354
                 $string .= ' &mdash; ' . $this->entered_house[$house]['reason'];
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     private function left_house_line($house, $house_name) {
361 361
         if ($this->house($house) && !$this->current_member($house)) {
362 362
             $string = "<strong>Left the $house_name ";
363
-            $string .= strlen($this->left_house[$house]['date_pretty'])==4 ? 'in ' : 'on ';
363
+            $string .= strlen($this->left_house[$house]['date_pretty']) == 4 ? 'in ' : 'on ';
364 364
             $string .= $this->left_house[$house]['date_pretty'] . '</strong>';
365 365
             if ($this->left_house[$house]['reason']) {
366 366
                 $string .= ' &mdash; ' . $this->left_house[$house]['reason'];
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
         $policy_diffs = array();
374 374
         $party_positions = $party->getAllPolicyPositions($policiesList);
375 375
 
376
-        if ( !$party_positions ) {
376
+        if (!$party_positions) {
377 377
             return $policy_diffs;
378 378
         }
379 379
 
380
-        foreach ( $positions->positionsById as $policy_id => $details ) {
381
-            if ( $details['has_strong'] && $details['score'] != -1 && isset($party_positions[$policy_id])) {
380
+        foreach ($positions->positionsById as $policy_id => $details) {
381
+            if ($details['has_strong'] && $details['score'] != -1 && isset($party_positions[$policy_id])) {
382 382
                 $mp_score = $details['score'];
383 383
                 $party_position = $party_positions[$policy_id];
384 384
                 $party_score = $party_position['score'];
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
                 $score_diff = $this->calculatePolicyDiffScore($mp_score, $party_score);
394 394
 
395 395
                 // skip anything that isn't a yes vs no diff
396
-                if ( $only_diffs && $score_diff < 2 ) {
396
+                if ($only_diffs && $score_diff < 2) {
397 397
                     continue;
398 398
                 }
399 399
                 $policy_diffs[$policy_id] = [
@@ -414,18 +414,18 @@  discard block
 block discarded – undo
414 414
         return $policy_diffs;
415 415
     }
416 416
 
417
-    private function calculatePolicyDiffScore( $mp_score, $party_score ) {
417
+    private function calculatePolicyDiffScore($mp_score, $party_score) {
418 418
         $score_diff = abs($mp_score - $party_score);
419 419
         // if they are on opposite sides of mixture of for and against
420 420
         if (
421
-            ( $mp_score < 0.4 && $party_score > 0.6 ) ||
422
-            ( $mp_score > 0.6 && $party_score < 0.4 )
421
+            ($mp_score < 0.4 && $party_score > 0.6) ||
422
+            ($mp_score > 0.6 && $party_score < 0.4)
423 423
         ) {
424 424
             $score_diff += 2;
425 425
         // if on is mixture of for and against and one is for/against
426 426
         } else if (
427
-            ( $mp_score > 0.4 && $mp_score < 0.6 && ( $party_score > 0.6 || $party_score < 0.4 ) ) ||
428
-            ( $party_score > 0.4 && $party_score < 0.6 && ( $mp_score > 0.6 || $mp_score < 0.4 ) )
427
+            ($mp_score > 0.4 && $mp_score < 0.6 && ($party_score > 0.6 || $party_score < 0.4)) ||
428
+            ($party_score > 0.4 && $party_score < 0.6 && ($mp_score > 0.6 || $mp_score < 0.4))
429 429
         ) {
430 430
             $score_diff += 1;
431 431
         }
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
         $mreg = array();
440 440
         $constituencies = \MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituencies($postcode);
441
-        if ( isset($constituencies[$type]) ) {
441
+        if (isset($constituencies[$type])) {
442 442
             $cons_name = $constituencies[$type];
443 443
             $query_base = "SELECT member.person_id, title, lordofname, given_name, family_name, constituency, house
444 444
                 FROM member, person_names
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
                     ':cons_name' => $cons_name
456 456
                 )
457 457
             );
458
-            if ( !$q->rows() && ($dissolution = Dissolution::db()) ) {
458
+            if (!$q->rows() && ($dissolution = Dissolution::db())) {
459 459
                 $q = $db->query("$query_base AND $dissolution[query]",
460 460
                     array(
461 461
                         ':house' => $house,
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
     }
480 480
 
481 481
     public static function getRepNameForHouse($house) {
482
-        switch ( $house ) {
482
+        switch ($house) {
483 483
             case HOUSE_TYPE_COMMONS:
484 484
                 $name = 'MP';
485 485
                 break;
Please login to merge, or discard this patch.
classes/Homepage.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     }
49 49
 
50 50
     protected function getRegionalList() {
51
-        return NULL;
51
+        return null;
52 52
     }
53 53
 
54 54
     protected function getEditorialContent() {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
         $gid = $featured->get_gid();
58 58
         $gidCheck = new Gid($gid);
59 59
         $gid = $gidCheck->checkForRedirect();
60
-        if ( $gid ) {
60
+        if ($gid) {
61 61
             $title = $featured->get_title();
62 62
             $context = $featured->get_context();
63 63
             $related = $featured->get_related();
64 64
             $item = $this->getFeaturedDebate($gid, $title, $context, $related);
65 65
         } else {
66 66
             $item = $debatelist->display('recent_debates', array('days' => 7, 'num' => 1), 'none');
67
-            if ( isset($item['data']) && count($item['data']) ) {
67
+            if (isset($item['data']) && count($item['data'])) {
68 68
                 $item = $item['data'][0];
69 69
                 $more_url = new Url('debates');
70 70
                 $item['more_url'] = $more_url->generate();
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
         $item['featured'] = true;
96 96
 
97 97
         $related_debates = array();
98
-        foreach ( $related as $related_gid ) {
99
-            if ( $related_gid ) {
98
+        foreach ($related as $related_gid) {
99
+            if ($related_gid) {
100 100
                 $related_item = $debatelist->display('featured_gid', array('gid' => $related_gid), 'none');
101 101
                 $related_debates[] = $related_item['data'];
102 102
             }
@@ -121,21 +121,21 @@  discard block
 block discarded – undo
121 121
 
122 122
         $recent_content = array();
123 123
 
124
-        foreach ( $this->recent_types as $class => $recent ) {
124
+        foreach ($this->recent_types as $class => $recent) {
125 125
             $class = "\\$class";
126 126
             $instance = new $class();
127 127
             $more_url = new Url($recent[1]);
128
-            if ( $recent[0] == 'recent_pbc_debates' ) {
129
-                $content = array( 'data' => $instance->display($recent[0], array('num' => 5), 'none') );
128
+            if ($recent[0] == 'recent_pbc_debates') {
129
+                $content = array('data' => $instance->display($recent[0], array('num' => 5), 'none'));
130 130
             } else {
131 131
                 $content = $instance->display($recent[0], array('days' => 7, 'num' => 1), 'none');
132
-                if ( isset($content['data']) && count($content['data']) ) {
132
+                if (isset($content['data']) && count($content['data'])) {
133 133
                     $content = $content['data'][0];
134 134
                 } else {
135 135
                     $content = array();
136 136
                 }
137 137
             }
138
-            if ( $content ) {
138
+            if ($content) {
139 139
                 $content['more_url'] = $more_url->generate();
140 140
                 $content['desc'] = $recent[2];
141 141
                 $recent_content[] = $content;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             WHERE event_date >= :date
155 155
             AND deleted = 0
156 156
             ORDER BY event_date, chamber, pos",
157
-            array( ':date' => $date )
157
+            array(':date' => $date)
158 158
         );
159 159
 
160 160
         $data = array();
Please login to merge, or discard this patch.
classes/Utility/Hansard.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 class Hansard
12 12
 {
13 13
     public static function get_gid_from_url($url) {
14
-        $gid = NULL;
14
+        $gid = null;
15 15
         $parts = parse_url($url);
16 16
         parse_str($parts['query'], $query);
17 17
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
         $parts = parse_url($url);
16 16
         parse_str($parts['query'], $query);
17 17
 
18
-        if ( $query['id'] ) {
18
+        if ($query['id']) {
19 19
             if (strpos($parts['path'], 'lords') !== false) {
20 20
                 $gid = 'uk.org.publicwhip/lords/';
21 21
             } elseif (strpos($parts['path'], 'whall') !== false) {
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 
31 31
 
32 32
     public static function gid_to_url($gid) {
33
-        if ( !$gid ) {
33
+        if (!$gid) {
34 34
             return '';
35 35
         }
36 36
         global $hansardmajors;
37 37
         $db = new \ParlDB();
38 38
 
39
-        $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array( ':gid' => $gid ))->first();
39
+        $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid))->first();
40 40
         $url_gid = fix_gid_from_db($gid);
41 41
         $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q['major']]['page']);
42 42
         $url->insert(array('id' => $url_gid));
Please login to merge, or discard this patch.
classes/Utility/Gaze.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         if (defined('OPTION_GAZE_URL') && OPTION_GAZE_URL) {
26 26
             return gaze_get_country_from_ip($ip);
27 27
         } else {
28
-            return NULL;
28
+            return null;
29 29
         }
30 30
 
31 31
     }
Please login to merge, or discard this patch.
classes/Utility/Postcode.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 
40 40
         if ($last_postcode == $postcode) {
41 41
             $return_value = $mp_only ? $last_postcode_value['WMC'] : $last_postcode_value;
42
-            twfy_debug ("TIME", "Postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value ));
42
+            twfy_debug ("TIME", "postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value ));
43 43
             return $return_value;
44 44
         }
45 45
 
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         if ($last_postcode == $postcode) {
41 41
             $return_value = $mp_only ? $last_postcode_value['WMC'] : $last_postcode_value;
42
-            twfy_debug ("TIME", "Postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value ));
42
+            twfy_debug("TIME", "Postcode $postcode looked up last time, is " . (is_array($return_value) ? implode(', ', $return_value) : $return_value));
43 43
             return $return_value;
44 44
         }
45 45
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
             $name = $q['name'];
76 76
             if (self::postcodeIsScottish($postcode)) {
77 77
                 $name = explode('|', $name);
78
-                if (count($name)==3)
78
+                if (count($name) == 3)
79 79
                     return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]);
80 80
             } elseif (self::postcodeIsNi($postcode)) {
81 81
                 $name = explode('|', $name);
82
-                if (count($name)==2)
82
+                if (count($name) == 2)
83 83
                     return array('WMC' => $name[0], 'NIE' => $name[1]);
84 84
             } else {
85 85
                 return array('WMC' => $name);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
         $r = json_decode($file, true);
115 115
         if (!$r) {
116
-            trigger_error("Postcode database is not working. Content:\n".$file.", request: ". $filename, E_USER_WARNING);
116
+            trigger_error("Postcode database is not working. Content:\n" . $file . ", request: " . $filename, E_USER_WARNING);
117 117
             return '';
118 118
         }
119 119
         if (isset($r['error']) || !isset($r['areas'])) {
@@ -179,29 +179,29 @@  discard block
 block discarded – undo
179 179
         if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE')))
180 180
             return true;
181 181
 
182
-        if ($m[1]=='DG') {
183
-            if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) return false; # A few postcodes in England
182
+        if ($m[1] == 'DG') {
183
+            if ($m[2] == 16 && $m[3] == 5 && in_array($m[4], array('HT', 'HU', 'HZ', 'JA', 'JB'))) return false; # A few postcodes in England
184 184
             return true;
185 185
         }
186 186
 
187 187
         # Damn postcodes crossing country boundaries
188
-        if ($m[1]=='TD') {
189
-            if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) return true; # TD1-8, 10-11, 13-14 all in Scotland
190
-            if ($m[2]==9) {
191
-                if ($m[3]!=0) return true; # TD9 1-9 all in Scotland
192
-                if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) return true; # Nearly all of TD9 0 in Scotland
188
+        if ($m[1] == 'TD') {
189
+            if ($m[2] != 15 && $m[2] != 12 && $m[2] != 9) return true; # TD1-8, 10-11, 13-14 all in Scotland
190
+            if ($m[2] == 9) {
191
+                if ($m[3] != 0) return true; # TD9 1-9 all in Scotland
192
+                if (!in_array($m[4], array('TJ', 'TP', 'TR', 'TS', 'TT', 'TU', 'TW'))) return true; # Nearly all of TD9 0 in Scotland
193 193
             }
194 194
             $m[5] = substr($m[4], 0, 1);
195
-            if ($m[2]==12) { # $m[3] will be 4 currently.
196
-                if ($m[4]=='XE') return true;
197
-                if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England
195
+            if ($m[2] == 12) { # $m[3] will be 4 currently.
196
+                if ($m[4] == 'XE') return true;
197
+                if (in_array($m[5], array('A', 'B', 'D', 'E', 'H', 'J', 'L', 'N', 'W', 'Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England
198 198
             }
199 199
             # TD15 is mostly England
200
-            if ($m[2]==15) {
201
-                if ($m[3]!=1) return false; # TD15 2 and 9 are in England
202
-                if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) return true;
203
-                if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') return true; # Most of TD15 1T* in Scotland
204
-                if ($m[5]=='X' && $m[4]!='XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland
200
+            if ($m[2] == 15) {
201
+                if ($m[3] != 1) return false; # TD15 2 and 9 are in England
202
+                if (in_array($m[4], array('BT', 'SU', 'SZ', 'UF', 'UG', 'UH', 'UJ', 'UL', 'US', 'UZ', 'WY', 'WZ'))) return true;
203
+                if ($m[5] == 'T' && $m[4] != 'TA' && $m[4] != 'TB') return true; # Most of TD15 1T* in Scotland
204
+                if ($m[5] == 'X' && $m[4] != 'XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland
205 205
             }
206 206
         }
207 207
 
Please login to merge, or discard this patch.
Braces   +61 added lines, -24 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
             $ret = self::postcodeFetchFromMapit($postcode);
53 53
         }
54 54
 
55
-        if (is_string($ret)) return $ret;
55
+        if (is_string($ret)) {
56
+            return $ret;
57
+        }
56 58
 
57 59
         $last_postcode = $postcode;
58 60
         $last_postcode_value = $ret;
@@ -75,12 +77,14 @@  discard block
 block discarded – undo
75 77
             $name = $q['name'];
76 78
             if (self::postcodeIsScottish($postcode)) {
77 79
                 $name = explode('|', $name);
78
-                if (count($name)==3)
79
-                    return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]);
80
+                if (count($name)==3) {
81
+                                    return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]);
82
+                }
80 83
             } elseif (self::postcodeIsNi($postcode)) {
81 84
                 $name = explode('|', $name);
82
-                if (count($name)==2)
83
-                    return array('WMC' => $name[0], 'NIE' => $name[1]);
85
+                if (count($name)==2) {
86
+                                    return array('WMC' => $name[0], 'NIE' => $name[1]);
87
+                }
84 88
             } else {
85 89
                 return array('WMC' => $name);
86 90
             }
@@ -121,8 +125,9 @@  discard block
 block discarded – undo
121 125
         }
122 126
         $areas = array();
123 127
         foreach ($r['areas'] as $row) {
124
-            if (in_array($row['type'], array('WMC', 'SPC', 'SPE', 'NIE')))
125
-                $areas[$row['type']] = $row['name'];
128
+            if (in_array($row['type'], array('WMC', 'SPC', 'SPE', 'NIE'))) {
129
+                            $areas[$row['type']] = $row['name'];
130
+            }
126 131
         }
127 132
 
128 133
         if (!isset($areas['WMC'])) {
@@ -172,36 +177,67 @@  discard block
 block discarded – undo
172 177
      */
173 178
 
174 179
     public static function postcodeIsScottish($pc) {
175
-        if (!preg_match('#^([A-Z]{1,2})(\d+) (\d)([A-Z]{2})#', self::canonicalisePostcode($pc), $m))
176
-            return false;
180
+        if (!preg_match('#^([A-Z]{1,2})(\d+) (\d)([A-Z]{2})#', self::canonicalisePostcode($pc), $m)) {
181
+                    return false;
182
+        }
177 183
 
178 184
         # Check for Scottish postal areas
179
-        if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE')))
180
-            return true;
185
+        if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE'))) {
186
+                    return true;
187
+        }
181 188
 
182 189
         if ($m[1]=='DG') {
183
-            if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) return false; # A few postcodes in England
190
+            if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) {
191
+                return false;
192
+            }
193
+            # A few postcodes in England
184 194
             return true;
185 195
         }
186 196
 
187 197
         # Damn postcodes crossing country boundaries
188 198
         if ($m[1]=='TD') {
189
-            if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) return true; # TD1-8, 10-11, 13-14 all in Scotland
199
+            if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) {
200
+                return true;
201
+            }
202
+            # TD1-8, 10-11, 13-14 all in Scotland
190 203
             if ($m[2]==9) {
191
-                if ($m[3]!=0) return true; # TD9 1-9 all in Scotland
192
-                if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) return true; # Nearly all of TD9 0 in Scotland
204
+                if ($m[3]!=0) {
205
+                    return true;
206
+                }
207
+                # TD9 1-9 all in Scotland
208
+                if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) {
209
+                    return true;
210
+                }
211
+                # Nearly all of TD9 0 in Scotland
193 212
             }
194 213
             $m[5] = substr($m[4], 0, 1);
195
-            if ($m[2]==12) { # $m[3] will be 4 currently.
196
-                if ($m[4]=='XE') return true;
197
-                if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England
214
+            if ($m[2]==12) {
215
+# $m[3] will be 4 currently.
216
+                if ($m[4]=='XE') {
217
+                    return true;
218
+                }
219
+                if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) {
220
+                    return true;
221
+                }
222
+                # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England
198 223
             }
199 224
             # TD15 is mostly England
200 225
             if ($m[2]==15) {
201
-                if ($m[3]!=1) return false; # TD15 2 and 9 are in England
202
-                if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) return true;
203
-                if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') return true; # Most of TD15 1T* in Scotland
204
-                if ($m[5]=='X' && $m[4]!='XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland
226
+                if ($m[3]!=1) {
227
+                    return false;
228
+                }
229
+                # TD15 2 and 9 are in England
230
+                if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) {
231
+                    return true;
232
+                }
233
+                if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') {
234
+                    return true;
235
+                }
236
+                # Most of TD15 1T* in Scotland
237
+                if ($m[5]=='X' && $m[4]!='XX') {
238
+                    return true;
239
+                }
240
+                # TD15 1XX in England, rest of TD15 1X* in Scotland
205 241
             }
206 242
         }
207 243
 
@@ -215,8 +251,9 @@  discard block
 block discarded – undo
215 251
 
216 252
     public static function postcodeIsNi($pc) {
217 253
         $prefix = substr(self::canonicalisePostcode($pc), 0, 2);
218
-        if ($prefix == 'BT')
219
-            return true;
254
+        if ($prefix == 'BT') {
255
+                    return true;
256
+        }
220 257
         return false;
221 258
     }
222 259
 
Please login to merge, or discard this patch.