Passed
Pull Request — master (#1837)
by Struan
04:39
created
www/includes/easyparliament/templates/html/mp/votes.php 3 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,13 +146,16 @@
 block discarded – undo
146 146
 
147 147
                         <?php endif; ?>
148 148
 
149
-                    <?php else: ?>
149
+                    <?php else {
150
+    : ?>
150 151
 
151 152
                         <div class="panel">
152 153
                             <p>This person has not voted on any of the key issues which we keep track of.</p>
153 154
                         </div>
154 155
 
155
-                    <?php endif; ?>
156
+                    <?php endif;
157
+}
158
+?>
156 159
 
157 160
                 <?php endif; ?>
158 161
                 <?php include('_covid19_panel.php'); ?>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@
 block discarded – undo
119 119
                           $policy_direction = $key_vote["person_position"];
120 120
                           $policy_group = "highlighted";
121 121
                           $party_score_difference = $key_vote["score_difference"];
122
-                          $party_position = $key_vote['party_position'] ;
122
+                          $party_position = $key_vote['party_position'];
123 123
                           $comparison_party = $data["comparison_party"];
124 124
                           $current_party_comparison = $data["current_party_comparison"];
125 125
                           $unslugified_comparison_party = ucwords(str_replace('-', ' ', $comparison_party));
Please login to merge, or discard this patch.
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -113,34 +113,34 @@  discard block
 block discarded – undo
113 113
                     <ul class="vote-descriptions">
114 114
                       <?php foreach ($sorted_diffs_only as $policy_id => $diff) {
115 115
 
116
-                          $key_vote = $diff;
117
-                          $covid_affected = in_array($policy_id, $covid_policy_list);
118
-                          $policy_desc = strip_tags($key_vote['policy_text']);
119
-                          $policy_direction = $key_vote["person_position"];
120
-                          $policy_group = "highlighted";
121
-                          $party_score_difference = $key_vote["score_difference"];
122
-                          $party_position = $key_vote['party_position'] ;
123
-                          $comparison_party = $data["comparison_party"];
124
-                          $current_party_comparison = $data["current_party_comparison"];
125
-                          $unslugified_comparison_party = ucwords(str_replace('-', ' ', $comparison_party));
126
-
127
-                          if (strlen($unslugified_comparison_party) == 3) {
128
-                              $unslugified_comparison_party = strtoupper($comparison_party);
129
-                          }
130
-                          $description = sprintf(
131
-                              '%s <b>%s</b> %s; comparable %s MPs <b>%s</b>.',
132
-                              $full_name,
133
-                              $diff['person_position'],
134
-                              strip_tags($diff['policy_text']),
135
-                              $unslugified_comparison_party,
136
-                              $diff['party_position']
137
-                          );
138
-                          $link = $member_url . '/divisions?policy=' . $policy_id;
139
-                          $link_text = 'Show votes';
140
-
141
-                          include '_vote_description.php';
142
-
143
-                      } ?>
116
+                            $key_vote = $diff;
117
+                            $covid_affected = in_array($policy_id, $covid_policy_list);
118
+                            $policy_desc = strip_tags($key_vote['policy_text']);
119
+                            $policy_direction = $key_vote["person_position"];
120
+                            $policy_group = "highlighted";
121
+                            $party_score_difference = $key_vote["score_difference"];
122
+                            $party_position = $key_vote['party_position'] ;
123
+                            $comparison_party = $data["comparison_party"];
124
+                            $current_party_comparison = $data["current_party_comparison"];
125
+                            $unslugified_comparison_party = ucwords(str_replace('-', ' ', $comparison_party));
126
+
127
+                            if (strlen($unslugified_comparison_party) == 3) {
128
+                                $unslugified_comparison_party = strtoupper($comparison_party);
129
+                            }
130
+                            $description = sprintf(
131
+                                '%s <b>%s</b> %s; comparable %s MPs <b>%s</b>.',
132
+                                $full_name,
133
+                                $diff['person_position'],
134
+                                strip_tags($diff['policy_text']),
135
+                                $unslugified_comparison_party,
136
+                                $diff['party_position']
137
+                            );
138
+                            $link = $member_url . '/divisions?policy=' . $policy_id;
139
+                            $link_text = 'Show votes';
140
+
141
+                            include '_vote_description.php';
142
+
143
+                        } ?>
144 144
                     </ul>
145 145
 
146 146
                     <?php } ?>
@@ -175,56 +175,56 @@  discard block
 block discarded – undo
175 175
 
176 176
                             <ul class="vote-descriptions">
177 177
                               <?php foreach ($segment['votes']->positions as $key_vote) {
178
-                                  $policy_id = $key_vote['policy_id'];
179
-                                  $covid_affected = in_array($policy_id, $covid_policy_list);
180
-                                  $policy_desc = strip_tags($key_vote['policy']);
181
-                                  $policy_direction = $key_vote["position"];
182
-                                  $policy_group = $segment['key'];
183
-
184
-                                  if (isset($policy_last_update[$policy_id]) && $policy_last_update[$policy_id] > $most_recent) {
185
-                                      $most_recent = $policy_last_update[$policy_id];
186
-                                  }
187
-
188
-                                  if ($key_vote['has_strong'] || $key_vote['position'] == 'has never voted on') {
189
-                                      $description = ucfirst($key_vote['desc']);
190
-                                  } else {
191
-                                      $description = sprintf(
192
-                                          'We don&rsquo;t have enough information to calculate %s&rsquo;s position on %s.',
193
-                                          $full_name,
194
-                                          $key_vote['policy']
195
-                                      );
196
-                                  }
197
-                                  $link = sprintf(
198
-                                      '%s/divisions?policy=%s',
199
-                                      $member_url,
200
-                                      $policy_id
201
-                                  );
202
-                                  $link_text = $key_vote['position'] != 'has never voted on' ? 'Show votes' : 'Details';
203
-                                  $comparison_party = $data["comparison_party"];
204
-
205
-                                  # Unslugify for display
206
-                                  $unslugified_comparison_party = ucwords(str_replace('-', ' ', $comparison_party));
207
-
208
-                                  if (strlen($unslugified_comparison_party) == 3) {
209
-                                      $unslugified_comparison_party = strtoupper($comparison_party);
210
-                                  }
211
-                                  $min_diff_score = 0; // setting this to 0 means that all comparisons are displayed.
212
-                                  if (isset($sorted_diffs[$policy_id])) {
213
-                                      $diff = $sorted_diffs[$policy_id];
214
-                                      $party_position = $diff['party_position'];
215
-                                      $party_score_difference = $diff["score_difference"];
216
-                                      if ($sorted_diffs[$policy_id]['score_difference'] > $min_diff_score && $party_member_count > 1) {
217
-                                          $party_voting_line = sprintf('Comparable %s MPs %s.', $unslugified_comparison_party, $diff['party_position']);
218
-                                      }
219
-                                  } else {
220
-                                      $party_voting_line = null;
221
-                                      $party_position = null;
222
-                                      $party_score_difference = null;
223
-                                  }
224
-
225
-                                  include '_vote_description.php';
226
-
227
-                              } ?>
178
+                                    $policy_id = $key_vote['policy_id'];
179
+                                    $covid_affected = in_array($policy_id, $covid_policy_list);
180
+                                    $policy_desc = strip_tags($key_vote['policy']);
181
+                                    $policy_direction = $key_vote["position"];
182
+                                    $policy_group = $segment['key'];
183
+
184
+                                    if (isset($policy_last_update[$policy_id]) && $policy_last_update[$policy_id] > $most_recent) {
185
+                                        $most_recent = $policy_last_update[$policy_id];
186
+                                    }
187
+
188
+                                    if ($key_vote['has_strong'] || $key_vote['position'] == 'has never voted on') {
189
+                                        $description = ucfirst($key_vote['desc']);
190
+                                    } else {
191
+                                        $description = sprintf(
192
+                                            'We don&rsquo;t have enough information to calculate %s&rsquo;s position on %s.',
193
+                                            $full_name,
194
+                                            $key_vote['policy']
195
+                                        );
196
+                                    }
197
+                                    $link = sprintf(
198
+                                        '%s/divisions?policy=%s',
199
+                                        $member_url,
200
+                                        $policy_id
201
+                                    );
202
+                                    $link_text = $key_vote['position'] != 'has never voted on' ? 'Show votes' : 'Details';
203
+                                    $comparison_party = $data["comparison_party"];
204
+
205
+                                    # Unslugify for display
206
+                                    $unslugified_comparison_party = ucwords(str_replace('-', ' ', $comparison_party));
207
+
208
+                                    if (strlen($unslugified_comparison_party) == 3) {
209
+                                        $unslugified_comparison_party = strtoupper($comparison_party);
210
+                                    }
211
+                                    $min_diff_score = 0; // setting this to 0 means that all comparisons are displayed.
212
+                                    if (isset($sorted_diffs[$policy_id])) {
213
+                                        $diff = $sorted_diffs[$policy_id];
214
+                                        $party_position = $diff['party_position'];
215
+                                        $party_score_difference = $diff["score_difference"];
216
+                                        if ($sorted_diffs[$policy_id]['score_difference'] > $min_diff_score && $party_member_count > 1) {
217
+                                            $party_voting_line = sprintf('Comparable %s MPs %s.', $unslugified_comparison_party, $diff['party_position']);
218
+                                        }
219
+                                    } else {
220
+                                        $party_voting_line = null;
221
+                                        $party_position = null;
222
+                                        $party_score_difference = null;
223
+                                    }
224
+
225
+                                    include '_vote_description.php';
226
+
227
+                                } ?>
228 228
                             </ul>
229 229
 
230 230
                             <div class="share-vote-descriptions">
Please login to merge, or discard this patch.
classes/Model/AnnouncementManagement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         }
177 177
 
178 178
         # discard any invalid banners
179
-        $banners = array_filter($banners, function ($banner) {
179
+        $banners = array_filter($banners, function($banner) {
180 180
             return is_valid_item($banner);
181 181
         });
182 182
 
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
         }
199 199
 
200 200
         # discard any invalid announcements
201
-        $items = array_filter($items, function ($item) {
201
+        $items = array_filter($items, function($item) {
202 202
             return is_valid_item($item);
203 203
         });
204 204
 
205 205
         # limit to announcements with the correct location
206
-        $items = array_filter($items, function ($item) use ($location) {
206
+        $items = array_filter($items, function($item) use ($location) {
207 207
             return in_array($location, $item->location);
208 208
         });
209 209
 
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/_profile_footer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 
6 6
     <p><?= gettext('For an explanation of the vote descriptions please see our page about <a href="/voting-information">voting information on TheyWorkForYou</a>.') ?></p>
7 7
 
8
-  <?php if(isset($data['photo_attribution_text'])) { ?>
8
+  <?php if (isset($data['photo_attribution_text'])) { ?>
9 9
     <p>
10
-      <?php if(isset($data['photo_attribution_link'])) { ?>
10
+      <?php if (isset($data['photo_attribution_link'])) { ?>
11 11
         <?= gettext('Profile photo:') ?>
12 12
         <a href="<?= $data['photo_attribution_link'] ?>"><?= $data['photo_attribution_text'] ?></a>
13 13
       <?php } else { ?>
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
       <?php } ?>
16 16
     </p>
17 17
   <?php } ?>
18
-  <?php if(!$image || !$image['exists']) { ?>
18
+  <?php if (!$image || !$image['exists']) { ?>
19 19
     <p>
20 20
         We&rsquo;re missing a photo of <?= $full_name ?>.
21 21
         If you have a photo <em>that you can release under
Please login to merge, or discard this patch.
classes/AlertView/Simple.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
         $existing = $this->alert->fetch_by_token($confirmation);
122 122
         preg_match('/speaker:(\d+)/', $existing['criteria'], $matches);
123 123
         $old_mp_id = $matches[1];
124
-        $old_mp = new \MySociety\TheyWorkForYou\Member([ 'person_id' => $old_mp_id ]);
125
-        $new_mp = new \MySociety\TheyWorkForYou\Member([ 'constituency' => $old_mp->constituency, 'house' => 1 ]);
124
+        $old_mp = new \MySociety\TheyWorkForYou\Member(['person_id' => $old_mp_id]);
125
+        $new_mp = new \MySociety\TheyWorkForYou\Member(['constituency' => $old_mp->constituency, 'house' => 1]);
126 126
 
127 127
         $q = $this->db->query(
128 128
             "SELECT alert_id, criteria, registrationtoken FROM alerts
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
         preg_match('/speaker:(\d+)/', $existing['criteria'], $matches);
186 186
         $criteria = $matches[1];
187 187
 
188
-        $old_mp = new \MySociety\TheyWorkForYou\Member([ 'person_id' => $criteria ]);
189
-        $new_mp = new \MySociety\TheyWorkForYou\Member([ 'constituency' => $old_mp->constituency, 'house' => 1 ]);
188
+        $old_mp = new \MySociety\TheyWorkForYou\Member(['person_id' => $criteria]);
189
+        $new_mp = new \MySociety\TheyWorkForYou\Member(['constituency' => $old_mp->constituency, 'house' => 1]);
190 190
 
191 191
         if ($this->alert->fetch_by_mp($existing['email'], $new_mp->person_id)) {
192 192
             $data = [
Please login to merge, or discard this patch.
classes/PolicyPositions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@
 block discarded – undo
210 210
                 $has_strong = 1;
211 211
             }
212 212
             $full_sentence = $consistency . ' ' . $policy_description;
213
-            $out = [ 'full_sentence' => $full_sentence, 'score' => $dmpscore, 'position' => $consistency, 'has_strong' => $has_strong ];
213
+            $out = ['full_sentence' => $full_sentence, 'score' => $dmpscore, 'position' => $consistency, 'has_strong' => $has_strong];
214 214
         }
215 215
 
216 216
         return $out;
Please login to merge, or discard this patch.
classes/Renderer/Markdown.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 
35 35
         $title = $matches[1];
36 36
 
37
-        $html = preg_replace_callback('/<h([1-3])>([^<]+)<\/h[1-3]>/i', function ($matches) {
37
+        $html = preg_replace_callback('/<h([1-3])>([^<]+)<\/h[1-3]>/i', function($matches) {
38 38
             $level = $matches[1];
39 39
             $htitle = $matches[2];
40 40
             $slug = slugify($htitle);
Please login to merge, or discard this patch.
classes/Search.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
         $data['search_keyword'] = $this->searchkeyword;
158 158
 
159 159
         $is_adv = false;
160
-        foreach (['to', 'from', 'person', 'section', 'column', 'phrase', 'exclude' ] as $var) {
160
+        foreach (['to', 'from', 'person', 'section', 'column', 'phrase', 'exclude'] as $var) {
161 161
             $key = "search_$var";
162 162
             $data[$key] = get_http_var($var);
163 163
             if ($data[$key]) {
Please login to merge, or discard this patch.
classes/Utility/Postcode.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 
43 43
         if ($last_postcode == $postcode) {
44 44
             $return_value = $mp_only ? $last_postcode_value['WMC'] : $last_postcode_value;
45
-            twfy_debug("TIME", "Postcode $postcode looked up last time, is " . (is_array($return_value) ? implode(', ', $return_value) : $return_value));
45
+            twfy_debug("TIME", "postcode $postcode looked up last time, is " . (is_array($return_value) ? implode(', ', $return_value) : $return_value));
46 46
             return $return_value;
47 47
         }
48 48
 
Please login to merge, or discard this patch.
classes/Utility/Hansard.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         global $hansardmajors;
39 39
         $db = new \ParlDB();
40 40
 
41
-        $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", [ ':gid' => $gid ])->first();
41
+        $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", [':gid' => $gid])->first();
42 42
         $url_gid = fix_gid_from_db($gid);
43 43
         $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q['major']]['page']);
44 44
         $url->insert(['id' => $url_gid]);
Please login to merge, or discard this patch.