Passed
Pull Request — master (#1428)
by Nick
06:09
created
www/includes/easyparliament/alert.php 3 patches
Braces   +30 added lines, -13 removed lines patch added patch discarded remove patch
@@ -340,17 +340,20 @@  discard block
 block discarded – undo
340 340
     }
341 341
 
342 342
     public function check_token($token) {
343
-        if (!is_null($this->token_checked))
344
-            return $this->token_checked;
343
+        if (!is_null($this->token_checked)) {
344
+                    return $this->token_checked;
345
+        }
345 346
 
346 347
         $arg = strstr($token, '::') ? '::' : '-';
347 348
         $token_parts = explode($arg, $token);
348
-        if (count($token_parts) != 2)
349
-            return false;
349
+        if (count($token_parts) != 2) {
350
+                    return false;
351
+        }
350 352
 
351 353
         list($alert_id, $registrationtoken) = $token_parts;
352
-        if (!is_numeric($alert_id) || !$registrationtoken)
353
-            return false;
354
+        if (!is_numeric($alert_id) || !$registrationtoken) {
355
+                    return false;
356
+        }
354 357
 
355 358
         $q = $this->db->query("SELECT alert_id, email, criteria
356 359
                         FROM alerts
@@ -398,7 +401,9 @@  discard block
 block discarded – undo
398 401
     // If all goes well the alert will be confirmed.
399 402
     // The alert will be active when scripts run each day to send the actual emails.
400 403
     public function confirm($token) {
401
-        if (!($alert = $this->check_token($token))) return false;
404
+        if (!($alert = $this->check_token($token))) {
405
+            return false;
406
+        }
402 407
         $this->criteria = $alert['criteria'];
403 408
         $this->email = $alert['email'];
404 409
         $r = $this->db->query("UPDATE alerts SET confirmed = 1, deleted = 0 WHERE alert_id = :alert_id", array(
@@ -412,7 +417,9 @@  discard block
 block discarded – undo
412 417
     // and the deletion page has passed the token from the URL to here.
413 418
     // If all goes well the alert will be deleted.
414 419
     public function delete($token) {
415
-        if (!($alert = $this->check_token($token))) return false;
420
+        if (!($alert = $this->check_token($token))) {
421
+            return false;
422
+        }
416 423
         $r = $this->db->query("DELETE FROM alerts WHERE alert_id = :alert_id", array(
417 424
             ':alert_id' => $alert['id']
418 425
             ));
@@ -421,7 +428,9 @@  discard block
 block discarded – undo
421 428
     }
422 429
 
423 430
     public function delete_all($token) {
424
-        if (!($alert = $this->check_token($token))) return false;
431
+        if (!($alert = $this->check_token($token))) {
432
+            return false;
433
+        }
425 434
         $r = $this->db->query("DELETE FROM alerts WHERE email = :email", array(
426 435
             ':email' => $alert['email']
427 436
             ));
@@ -430,7 +439,9 @@  discard block
 block discarded – undo
430 439
     }
431 440
 
432 441
     public function suspend($token) {
433
-        if (!($alert = $this->check_token($token))) return false;
442
+        if (!($alert = $this->check_token($token))) {
443
+            return false;
444
+        }
434 445
         $r = $this->db->query("UPDATE alerts SET deleted = 2 WHERE alert_id = :alert_id", array(
435 446
             ':alert_id' => $alert['id']
436 447
             ));
@@ -439,7 +450,9 @@  discard block
 block discarded – undo
439 450
     }
440 451
 
441 452
     public function resume($token) {
442
-        if (!($alert = $this->check_token($token))) return false;
453
+        if (!($alert = $this->check_token($token))) {
454
+            return false;
455
+        }
443 456
         $r = $this->db->query("UPDATE alerts SET deleted = 0 WHERE alert_id = :alert_id", array(
444 457
             ':alert_id' => $alert['id']
445 458
             ));
@@ -460,8 +473,12 @@  discard block
 block discarded – undo
460 473
             }
461 474
         }
462 475
         $criteria = '';
463
-        if (count($words)) $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n";
464
-        if ($spokenby) $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n";
476
+        if (count($words)) {
477
+            $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n";
478
+        }
479
+        if ($spokenby) {
480
+            $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n";
481
+        }
465 482
         return $criteria;
466 483
     }
467 484
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@
 block discarded – undo
52 52
 // FUNCTION: fetch_between
53 53
 
54 54
     public function fetch_between($confirmed, $deleted, $start_date, $end_date) {
55
-      // Return summary data on all the alerts that were created between $start_date
56
-      // and $end_date (inclusive) and whose confirmed and deleted values match the booleans
57
-      // passed in $confirmed and $deleted
55
+        // Return summary data on all the alerts that were created between $start_date
56
+        // and $end_date (inclusive) and whose confirmed and deleted values match the booleans
57
+        // passed in $confirmed and $deleted
58 58
         $q = $this->db->query("SELECT   criteria, count(*) as cnt
59 59
             FROM     alerts
60 60
             WHERE    confirmed = :confirmed
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public $token_checked = null;
42 42
     private $alert_id = "";
43 43
     public $email = "";
44
-    public $criteria = "";		// Sets the terms that are used to produce the search results.
44
+    public $criteria = ""; // Sets the terms that are used to produce the search results.
45 45
 
46 46
     private $db;
47 47
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             $contents = array('criteria' => $row['criteria'], 'count' => $row['cnt']);
73 73
             $data[] = $contents;
74 74
         }
75
-        $data = array ('alerts' => $data);
75
+        $data = array('alerts' => $data);
76 76
         return $data;
77 77
     }
78 78
 
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
             $data[] = $contents;
112 112
         }
113 113
         $info = "Alert";
114
-        $data = array ('info' => $info, 'data' => $data);
114
+        $data = array('info' => $info, 'data' => $data);
115 115
 
116 116
         return $data;
117 117
     }
118 118
 
119
-    public function add($details, $confirmation_email=false, $instantly_confirm=true) {
119
+    public function add($details, $confirmation_email = false, $instantly_confirm = true) {
120 120
 
121 121
         // Adds a new alert's info into the database.
122 122
         // Then calls another function to send them a confirmation email.
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             // This gives a code for their email address which is then joined
180 180
             // to the timestamp so as to provide a unique ID for each alert.
181 181
 
182
-            $token = substr( password_hash($details["email"] . microtime(), PASSWORD_BCRYPT), 29, 16 );
182
+            $token = substr(password_hash($details["email"] . microtime(), PASSWORD_BCRYPT), 29, 16);
183 183
 
184 184
             // Full stops don't work well at the end of URLs in emails,
185 185
             // so replace them. We won't be doing anything clever with the hash
@@ -252,19 +252,19 @@  discard block
 block discarded – undo
252 252
 
253 253
         $urltoken = $this->alert_id . '-' . $this->registrationtoken;
254 254
 
255
-        if ( isset($details['confirm_base']) && $details['confirm_base'] !== '' ) {
255
+        if (isset($details['confirm_base']) && $details['confirm_base'] !== '') {
256 256
             $confirmurl = $details['confirm_base'] . $urltoken;
257 257
         } else {
258 258
             $confirmurl = 'https://' . DOMAIN . '/A/' . $urltoken;
259 259
         }
260 260
 
261 261
         // Arrays we need to send a templated email.
262
-        $data = array (
262
+        $data = array(
263 263
             'to' 		=> $details['email'],
264 264
             'template' 	=> 'alert_confirmation'
265 265
         );
266 266
 
267
-        $merge = array (
267
+        $merge = array(
268 268
             'FIRSTNAME' 	=> 'THEY WORK FOR YOU',
269 269
             'LASTNAME' 		=> ' ALERT CONFIRMATION',
270 270
             'CONFIRMURL'	=> $confirmurl,
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     }
281 281
 
282 282
     public function send_already_signedup_email($details) {
283
-        $data = array (
283
+        $data = array(
284 284
             'to' 		=> $details['email'],
285 285
             'template' 	=> 'alert_already_signedup'
286 286
         );
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $criteria = \MySociety\TheyWorkForYou\Utility\Alert::detailsToCriteria($details);
289 289
         $this->criteria = $criteria;
290 290
 
291
-        $merge = array (
291
+        $merge = array(
292 292
             'FIRSTNAME' 	=> 'THEY WORK FOR YOU',
293 293
             'LASTNAME' 		=> ' ALERT ALREADY SIGNED UP',
294 294
             'CRITERIA'	=> $this->criteria_pretty()
@@ -448,17 +448,17 @@  discard block
 block discarded – undo
448 448
     public function email() { return $this->email; }
449 449
     public function criteria() { return $this->criteria; }
450 450
     public function criteria_pretty($html = false) {
451
-        $criteria = explode(' ',$this->criteria);
451
+        $criteria = explode(' ', $this->criteria);
452 452
         $spokenby = array_values(\MySociety\TheyWorkForYou\Utility\Search::speakerNamesForIDs($this->criteria));
453 453
         $words = array();
454 454
         foreach ($criteria as $c) {
455
-            if (!preg_match('#^speaker:(\d+)#',$c,$m)) {
455
+            if (!preg_match('#^speaker:(\d+)#', $c, $m)) {
456 456
                 $words[] = $c;
457 457
             }
458 458
         }
459 459
         $criteria = '';
460
-        if (count($words)) $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n";
461
-        if ($spokenby) $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n";
460
+        if (count($words)) $criteria .= ($html ? '<li>' : '* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html ? '</li>' : '') . "\n";
461
+        if ($spokenby) $criteria .= ($html ? '<li>' : '* ') . "Things by " . implode(' or ', $spokenby) . ($html ? '</li>' : '') . "\n";
462 462
         return $criteria;
463 463
     }
464 464
 
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/people/index.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
                           Based on postcode <strong><?= $mp_data['postcode'] ?></strong>
27 27
                           <a href="<?= $mp_data['change_url'] ?>">(Change postcode)</a>
28 28
                       </p>
29
-                    <?php if ( isset( $mp_data ) && $type != 'mlas' ) { ?>
29
+                    <?php if (isset($mp_data) && $type != 'mlas') { ?>
30 30
                       <h3>Your <?= $mp_data['former'] ? $mp_data['former'] . ' ' : '' ?><?= $rep_name ?> is</h3>
31 31
                     </div>
32 32
                     <a href="<?= $mp_data['mp_url'] ?>" class="people-list__person">
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
                         </p>
39 39
                     </a>
40 40
                     <?php }
41
-                    if ( isset($reps) ) {
42
-                        if ( isset($mp_data) && $type != 'mlas' ) { ?>
41
+                    if (isset($reps)) {
42
+                        if (isset($mp_data) && $type != 'mlas') { ?>
43 43
                     <div class="people-list__your-mp__replist-header">
44 44
                         <?php } ?>
45 45
                       <h3>Your <?=$former ?> <?= $rep_plural == 'MSPs' ? 'regional ' : '' ?><?= $rep_plural ?> are</h3>
46 46
                     </div>
47
-                        <?php foreach ( $reps as $rep ) { ?>
47
+                        <?php foreach ($reps as $rep) { ?>
48 48
                     <a href="<?= $rep['mp_url'] ?>" class="people-list__person">
49 49
                     <img class="people-list__person__image" src="<?= $rep['image'] ?>">
50 50
                         <h2 class="people-list__person__name"><?= $rep['name'] ?></h2>
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
             <div class="search-page__section search-page__section--search">
66 66
                 <div class="search-page__section__primary">
67 67
                     <p class="search-page-main-inputs">
68
-                    <?php if ( $type == 'peers' ) { ?>
68
+                    <?php if ($type == 'peers') { ?>
69 69
                         <label for="find-mp-by-name-or-postcode">Find <?= $rep_plural ?> by name:</label>
70
-                    <?php } elseif ( $type == 'mlas' || $type == 'msps' ) { ?>
70
+                    <?php } elseif ($type == 'mlas' || $type == 'msps') { ?>
71 71
                         <label for="find-mp-by-name-or-postcode">Find your <?= $rep_name ?> by postcode:</label>
72 72
                     <?php } else { ?>
73 73
                         <label for="find-mp-by-name-or-postcode">Find your <?= $rep_name ?> by name or postcode:</label>
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
             <div class="search-page__section__primary">
109 109
             <h2>All <?= $rep_plural ?></h2>
110 110
 
111
-                <?php if ( $type != 'peers' ) { ?>
111
+                <?php if ($type != 'peers') { ?>
112 112
                 <ul class="search-result-display-options">
113
-                    <?php if ( $order == 'given_name' ) { ?>
113
+                    <?php if ($order == 'given_name') { ?>
114 114
                     <li><strong>Sorted by</strong> First name</li>
115 115
                     <li>Sort by <a href="<?= $urls['by_last'] ?>">Last name</a> / <a href="<?= $urls['by_party'] ?>">Party</a></li>
116
-                    <?php } else if ( $order == 'party' ) { ?>
116
+                    <?php } else if ($order == 'party') { ?>
117 117
                     <li><strong>Sorted by</strong> Party</li>
118 118
                     <li>Sort by <a href="<?= $urls['by_first'] ?>">First name</a> / <a href="<?= $urls['by_last'] ?>">Last name</a></li>
119 119
                     <?php } else { ?>
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 </ul>
124 124
                 <?php } else { ?>
125 125
                 <ul class="search-result-display-options">
126
-                    <?php if ( $order == 'party' ) { ?>
126
+                    <?php if ($order == 'party') { ?>
127 127
                     <li><strong>Sorted by</strong> Party</li>
128 128
                     <li>Sort by <a href="<?= $urls['by_name'] ?>">Name</a></li>
129 129
                     <?php } else { ?>
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
                     }
174 174
                 }
175 175
                 $initial_link = '';
176
-                foreach ( $data as $person ) {
176
+                foreach ($data as $person) {
177 177
                     if ($order != 'party') {
178
-                        $initial = substr( strtoupper($person[$a_to_z_key]), 0, 1);
179
-                        if ( $initial != $current_initial ) {
178
+                        $initial = substr(strtoupper($person[$a_to_z_key]), 0, 1);
179
+                        if ($initial != $current_initial) {
180 180
                             $current_initial = $initial;
181 181
                             $initial_link = "name=\"$initial\" ";
182 182
                         } else {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 <img class="people-list__person__image" src="<?= $person['image'] ?>">
189 189
                         <h2 class="people-list__person__name"><?= ucfirst($person['name']) ?></h2>
190 190
                         <p class="people-list__person__memberships">
191
-                        <?php if ( $person['constituency'] ) { ?>
191
+                        <?php if ($person['constituency']) { ?>
192 192
                         <span class="people-list__person__constituency"><?= $person['constituency'] ?></span>
193 193
                         <?php } ?>
194 194
                         <span class="people-list__person__party <?= slugify($person['party']) ?>"><?= $person['party'] ?></span>
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                 <a href="<?= $urls['by_csv'] ?>">Download this list as a CSV</a>
207 207
                     suitable for Excel
208 208
                 </p>
209
-                <?php if ( $type == 'mps' ) { ?>
209
+                <?php if ($type == 'mps') { ?>
210 210
                 <form method="get" action="<?= $urls['plain'] ?>" class="sidebar-item-with-icon sidebar-item-with-icon--date">
211 211
                     <p>
212 212
                         Or view a past list
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
                   })
259 259
                 });
260 260
                 </script>
261
-                <?php } else if ( $type == 'msps' ) { ?>
261
+                <?php } else if ($type == 'msps') { ?>
262 262
                     <p class="past-list-dates" id="past-list-dates">
263 263
                         <a href="<?= $urls['plain'] ?>?date=2011-05-05">MSPs at 2011 election</a>
264 264
                         <a href="<?= $urls['plain'] ?>?date=2007-05-03">MSPs at 2007 election</a>
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                     </p>
273 273
                 <?php } ?>
274 274
 
275
-                <?php include( dirname(__FILE__) . '/../sidebar/looking_for.php' ) ?>
275
+                <?php include(dirname(__FILE__) . '/../sidebar/looking_for.php') ?>
276 276
             </div>
277 277
         </div>
278 278
 
Please login to merge, or discard this patch.
www/docs/divisions/division.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 if ($data['division']['house'] == 'pbc') {
59 59
     $location = '&ndash; in a Public Bill Committee';
60 60
 }
61
-$data['debate_time_human'] = False;
61
+$data['debate_time_human'] = false;
62 62
 $data['debate_day_human'] = format_date($data['division']['date'], LONGDATEFORMAT);
63 63
 $data['col_country'] = $country;
64 64
 $data['location'] = $location;
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@
 block discarded – undo
45 45
             $data['mp_vote']['with_majority'] = true;
46 46
         }
47 47
     } else {
48
-      if ($data['division']['date'] < $MEMBER->entered_house($division_votes['house_number'])['date']) {
49
-          $data['before_mp'] = true;
50
-      } else if ($data['division']['date'] > $MEMBER->left_house($division_votes['house_number'])['date']) {
51
-          $data['after_mp'] = true;
52
-      }
48
+        if ($data['division']['date'] < $MEMBER->entered_house($division_votes['house_number'])['date']) {
49
+            $data['before_mp'] = true;
50
+        } else if ($data['division']['date'] > $MEMBER->left_house($division_votes['house_number'])['date']) {
51
+            $data['after_mp'] = true;
52
+        }
53 53
     }
54 54
 
55 55
     $mp_data = array(
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/divisions/_votes.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,20 +38,20 @@
 block discarded – undo
38 38
 
39 39
 $vote_sets = array(
40 40
     'yes_votes' => array(
41
-      'title' => 'Aye',
42
-      'anchor' => 'for',
41
+        'title' => 'Aye',
42
+        'anchor' => 'for',
43 43
     ),
44 44
     'no_votes' => array(
45
-      'title' => 'No',
46
-      'anchor' => 'against',
45
+        'title' => 'No',
46
+        'anchor' => 'against',
47 47
     ),
48 48
     'absent_votes' => array(
49
-      'title' => 'Absent',
50
-      'anchor' => 'absent',
49
+        'title' => 'Absent',
50
+        'anchor' => 'absent',
51 51
     ),
52 52
     'both_votes' => array(
53
-      'title' => 'Abstained',
54
-      'anchor' => 'both',
53
+        'title' => 'Abstained',
54
+        'anchor' => 'both',
55 55
     ),
56 56
 );
57 57
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@
 block discarded – undo
24 24
 });
25 25
 $sections_with_votes = array_values($sections_with_votes);
26 26
 
27
-for ($i=0; $i<count($sections_with_votes); $i+=2) {
27
+for ($i = 0; $i < count($sections_with_votes); $i += 2) {
28 28
     $l = $sections_with_votes[$i];
29
-    $r = $i+1 < count($sections_with_votes) ? $sections_with_votes[$i+1] : null;
29
+    $r = $i + 1 < count($sections_with_votes) ? $sections_with_votes[$i + 1] : null;
30 30
 
31 31
     $vote_title = $vote_sets[$l]['title'];
32 32
     $anchor = $vote_sets[$l]['anchor'];
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/divisions/_your_mp.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@
 block discarded – undo
1 1
 <div class="debate-speech__division__your-mp">
2
-  <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?>
2
+  <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) {
3
+/* $main_vote_mp is true if an MP has been requested via the URL */ ?>
3 4
     <div class="your-mp__header">
4 5
       <h3>How your <?= $division['members']['singular'] ?> voted</h3>
5 6
       <p>
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <div class="debate-speech__division__your-mp">
2
-  <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?>
2
+  <?php if (!isset($main_vote_mp) || !$main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?>
3 3
     <div class="your-mp__header">
4 4
       <h3>How your <?= $division['members']['singular'] ?> voted</h3>
5 5
       <p>
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     </div>
10 10
   <?php } ?>
11 11
     <a href="<?= $data['mp_data']['mp_url'] ?>" class="your-mp__content">
12
-      <?php if ( isset($mp_vote) ) { ?>
12
+      <?php if (isset($mp_vote)) { ?>
13 13
         <span class="your-mp__vote your-mp__vote--<?= $mp_vote['vote'] ?>"><?php
14 14
           switch ($mp_vote['vote']) {
15 15
               case 'aye':
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
                   echo 'N/A';
34 34
           }
35 35
         ?></span>
36
-      <?php } else if ( isset($before_mp) || isset($after_mp) ) { ?>
36
+      <?php } else if (isset($before_mp) || isset($after_mp)) { ?>
37 37
         <span class="your-mp__vote">N/A</span>
38 38
       <?php } ?>
39 39
         <img class="your-mp__image" src="<?= $data['mp_data']['image'] ?>">
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             <h2 class="people-list__person__name"><?= $data['mp_data']['name'] ?></h2>
42 42
             <p class="people-list__person__memberships">
43 43
                 <span class="people-list__person__constituency"><?= $data['mp_data']['constituency'] ?></span>
44
-                <span class="people-list__person__party <?= slugify( $data['mp_data']['party'] ) ?>"><?= $data['mp_data']['party'] ?></span>
44
+                <span class="people-list__person__party <?= slugify($data['mp_data']['party']) ?>"><?= $data['mp_data']['party'] ?></span>
45 45
             </p>
46 46
         </div>
47 47
     </a>
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,28 +11,28 @@
 block discarded – undo
11 11
     <a href="<?= $data['mp_data']['mp_url'] ?>" class="your-mp__content">
12 12
       <?php if ( isset($mp_vote) ) { ?>
13 13
         <span class="your-mp__vote your-mp__vote--<?= $mp_vote['vote'] ?>"><?php
14
-          switch ($mp_vote['vote']) {
15
-              case 'aye':
14
+            switch ($mp_vote['vote']) {
15
+                case 'aye':
16 16
                   echo 'Aye';
17
-                  break;
18
-              case 'no':
17
+                    break;
18
+                case 'no':
19 19
                   echo 'No';
20
-                  break;
21
-              case 'absent':
20
+                    break;
21
+                case 'absent':
22 22
                   echo 'Absent';
23
-                  break;
24
-              case 'both':
23
+                    break;
24
+                case 'both':
25 25
                   echo 'Abstain';
26
-                  break;
27
-              case 'tellaye':
26
+                    break;
27
+                case 'tellaye':
28 28
                   echo 'Aye (Teller)';
29
-                  break;
30
-              case 'tellno':
29
+                    break;
30
+                case 'tellno':
31 31
                   echo 'No (Teller)';
32
-                  break;
33
-              default:
32
+                    break;
33
+                default:
34 34
                   echo 'N/A';
35
-          }
35
+            }
36 36
         ?></span>
37 37
       <?php } else if ( isset($before_mp) || isset($after_mp) ) { ?>
38 38
         <span class="your-mp__vote">N/A</span>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/alert/_list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <h3>Your current email alerts</h3>
2 2
 
3 3
 <ul class="alerts-manage__list">
4
-  <?php foreach ( $alerts as $alert ) { ?>
4
+  <?php foreach ($alerts as $alert) { ?>
5 5
     <li>
6 6
         When <?= _htmlspecialchars($alert['criteria']) ?>.
7 7
         <form action="<?= $actionurl ?>" method="POST">
8 8
             <input type="hidden" name="t" value="<?= _htmlspecialchars($alert['token']) ?>">
9
-          <?php if ( $alert['status'] == 'unconfirmed' ) { ?>
9
+          <?php if ($alert['status'] == 'unconfirmed') { ?>
10 10
             <input type="submit" class="button small" name="action" value="Confirm">
11
-          <?php } elseif ( $alert['status'] == 'suspended' ) { ?>
11
+          <?php } elseif ($alert['status'] == 'suspended') { ?>
12 12
             <input type="submit" class="button small" name="action" value="Resume">
13 13
           <?php } else { ?>
14 14
             <input type="submit" class="button button--secondary small" name="action" value="Suspend">
Please login to merge, or discard this patch.
classes/Utility/Alert.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         }
20 20
 
21 21
         if (!empty($details['pid'])) {
22
-            $criteria[] = 'speaker:'.$details['pid'];
22
+            $criteria[] = 'speaker:' . $details['pid'];
23 23
         }
24 24
 
25 25
         $criteria = join(' ', $criteria);
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
             $token = $row['alert_id'] . '-' . $row['registrationtoken'];
42 42
 
43 43
             $status = 'confirmed';
44
-            if ( !$row['confirmed'] ) {
44
+            if (!$row['confirmed']) {
45 45
                 $status = 'unconfirmed';
46
-            } elseif ( $row['deleted'] == 2 ) {
46
+            } elseif ($row['deleted'] == 2) {
47 47
                 $status = 'suspended';
48 48
             }
49 49
 
@@ -60,21 +60,21 @@  discard block
 block discarded – undo
60 60
 
61 61
     public static function prettifyCriteria($alert_criteria) {
62 62
         $text = '';
63
-        if ( $alert_criteria ) {
63
+        if ($alert_criteria) {
64 64
             $criteria = explode(' ', $alert_criteria);
65 65
             $words = array();
66 66
             $spokenby = array_values(\MySociety\TheyWorkForYou\Utility\Search::speakerNamesForIDs($alert_criteria));
67 67
 
68 68
             foreach ($criteria as $c) {
69
-                if (!preg_match('#^speaker:(\d+)#',$c,$m)) {
69
+                if (!preg_match('#^speaker:(\d+)#', $c, $m)) {
70 70
                     $words[] = $c;
71 71
                 }
72 72
             }
73
-            if ( $spokenby && count($words) ) {
73
+            if ($spokenby && count($words)) {
74 74
                 $text = implode(' or ', $spokenby) . ' mentions [' . implode(' ', $words) . ']';
75
-            } else if ( count( $words ) ) {
75
+            } else if (count($words)) {
76 76
                 $text = '[' . implode(' ', $words) . ']' . ' is mentioned';
77
-            } else if ( $spokenby ) {
77
+            } else if ($spokenby) {
78 78
                 $text = implode(' or ', $spokenby) . " speaks";
79 79
             }
80 80
         }
Please login to merge, or discard this patch.
www/docs/section.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@
 block discarded – undo
21 21
     if (isset($THEUSER) && $THEUSER->postcode_is_set()) {
22 22
         try {
23 23
             $MEMBER = new MySociety\TheyWorkForYou\Member(array('postcode' => $THEUSER->postcode(), 'house' => \MySociety\TheyWorkForYou\Utility\House::majorToHouse($view->major)[0]));
24
-        } catch ( MySociety\TheyWorkForYou\MemberException $e ) {
24
+        } catch (MySociety\TheyWorkForYou\MemberException $e) {
25 25
             $MEMBER = null;
26 26
         }
27 27
     }
28 28
 
29 29
     $data = $view->display();
30 30
     if ($data) {
31
-        if ( !empty($data['template']) ) {
31
+        if (!empty($data['template'])) {
32 32
             $template = $data['template'];
33 33
         } else {
34 34
             $template = 'section/section';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 }
14 14
 
15 15
 if ($type = ucfirst(get_http_var('type'))) {
16
-    $class_name = "MySociety\TheyWorkForYou\SectionView\\${type}View";
16
+    $class_name = "MySociety\TheyWorkForYou\SectionView\\${type}view";
17 17
     $view = new $class_name();
18 18
 
19 19
     // use this for generating member vote data
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/divisions/vote.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
                   <?php if (isset($data['mp_data'])) {
29 29
                     include('_your_mp.php');
30
-                  } ?>
30
+                    } ?>
31 31
 
32 32
                     <div class="debate-speech__division__details">
33 33
                       <p>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
                           </span><br>
38 38
                       <?php } else { ?>
39 39
                           <?php if ($mp_vote['with_majority']) { ?>
40
-                              <?php $vote_prefix = 'A majority of ' . $division['members']['plural']  . ' <b>agreed</b> and'; include('_vote_description.php'); ?>
40
+                              <?php $vote_prefix = 'A majority of ' . $division['members']['plural'] . ' <b>agreed</b> and'; include('_vote_description.php'); ?>
41 41
                           <?php } else { ?>
42 42
                               <?php $vote_prefix = 'A majority of ' . $division['members']['plural'] . ' <b>disagreed</b> and'; include('_vote_description.php'); ?>
43 43
                           <?php } ?>
Please login to merge, or discard this patch.