Passed
Push — master ( 5f2bd1...7c2064 )
by
unknown
13:34
created
scripts/alertmailer.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -423,7 +423,7 @@
 block discarded – undo
423 423
 
424 424
     $text .= '====================';
425 425
     $sentemails++;
426
-    mlog("SEND $sentemails : Sending email to $current[email] ... ");
426
+    mlog("send $sentemails : Sending email to $current[email] ... ");
427 427
     $d = array('to' => $current['email'], 'template' => $template);
428 428
     $m = array(
429 429
         'DATA' => $text,
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
     $data = $DEBATELIST->_get_data_by_search($args);
246 246
     $total_results = $data['info']['total_results'];
247 247
     $queries++;
248
-    mlog(", hits " . $total_results . ", time " . (getmicrotime()-$start) . "\n");
248
+    mlog(", hits " . $total_results . ", time " . (getmicrotime() - $start) . "\n");
249 249
 
250 250
     # Divisions
251 251
     if (preg_match('#^speaker:(\d+)$#', $criteria_raw, $m)) {
Please login to merge, or discard this patch.
classes/Model/Featured.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
         if ($q) {
66 66
             $text = $q['value'];
67
-            if ( trim($text) == '' ) {
67
+            if (trim($text) == '') {
68 68
                 $text = null;
69 69
             }
70 70
         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     }
74 74
 
75 75
     private function _set($key, $value) {
76
-        if ( trim($value) == '' ) {
76
+        if (trim($value) == '') {
77 77
             $value = null;
78 78
         }
79 79
         $check_q = $this->db->query(
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 ':key' => $key
83 83
             )
84 84
         );
85
-        if ( $check_q->rows() ) {
85
+        if ($check_q->rows()) {
86 86
             $set_q = $this->db->query("UPDATE editorial set value = :value WHERE item = :key",
87 87
                 array(
88 88
                     ':key' => $key,
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             );
99 99
         }
100 100
 
101
-        if ( $set_q->success() ) {
101
+        if ($set_q->success()) {
102 102
             return true;
103 103
         }
104 104
         return false;
Please login to merge, or discard this patch.
classes/SectionView/SpwransView.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
         $this_page = 'spwransfront';
22 22
         $data = array();
23 23
 
24
-        $args = array( 'months' => 1 );
24
+        $args = array('months' => 1);
25 25
         $WRANSLIST = new \SPWRANSLIST;
26 26
 
27 27
         $wrans = array();
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
     protected function getSearchSections() {
45 45
         return array(
46
-            array( 'section' => 'spwrans' )
46
+            array('section' => 'spwrans')
47 47
         );
48 48
     }
49 49
 
@@ -54,29 +54,29 @@  discard block
 block discarded – undo
54 54
         $SPWRANSLIST = new \SPWRANSLIST;
55 55
         $gid = $SPWRANSLIST->get_gid_from_spid($spid);
56 56
         if ($gid) {
57
-            if (preg_match('/uk\.org\.publicwhip\/spwa\/(\d{4}-\d\d-\d\d\.(.*))/',$gid,$m)) {
57
+            if (preg_match('/uk\.org\.publicwhip\/spwa\/(\d{4}-\d\d-\d\d\.(.*))/', $gid, $m)) {
58 58
                 $URL = new \MySociety\TheyWorkForYou\Url('spwrans');
59 59
                 $URL->reset();
60
-                $URL->insert( array('id' => $m[1]) );
60
+                $URL->insert(array('id' => $m[1]));
61 61
                 $fragment_identifier = '#g' . $m[2];
62 62
                 header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303);
63 63
                 exit;
64
-            } elseif (preg_match('/uk\.org\.publicwhip\/spor\/(\d{4}-\d\d-\d\d\.(.*))/',$gid,$m)) {
64
+            } elseif (preg_match('/uk\.org\.publicwhip\/spor\/(\d{4}-\d\d-\d\d\.(.*))/', $gid, $m)) {
65 65
                 $URL = new \MySociety\TheyWorkForYou\Url('spdebates');
66 66
                 $URL->reset();
67
-                $URL->insert( array('id' => $m[1]) );
67
+                $URL->insert(array('id' => $m[1]));
68 68
                 $fragment_identifier = '#g' . $m[2];
69 69
                 header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303);
70 70
                 exit;
71 71
             } else {
72
-                $PAGE->error_message ("Strange GID ($gid) for that Scottish Parliament ID.");
72
+                $PAGE->error_message("Strange GID ($gid) for that Scottish Parliament ID.");
73 73
             }
74 74
         }
75
-        $PAGE->error_message ("Couldn't match that Scottish Parliament ID to a GID.");
75
+        $PAGE->error_message("Couldn't match that Scottish Parliament ID to a GID.");
76 76
     }
77 77
 
78 78
     protected function get_question_mentions_html($row_data) {
79
-        if( count($row_data) == 0 ) {
79
+        if (count($row_data) == 0) {
80 80
             return '';
81 81
         }
82 82
         $result = '';
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
         // Keep the references until after the history that's in a timeline:
86 86
         $references = array();
87 87
         foreach ($row_data as $row) {
88
-            if( ! $row["date"] ) {
88
+            if (!$row["date"]) {
89 89
                 // If this mention isn't associated with a date, the difference won't be interesting.
90 90
                 $last_date = null;
91 91
             }
92 92
             $description = '';
93 93
             if ($last_date && ($last_date != $row["date"])) {
94 94
                 // Calculate how long the gap was in days:
95
-                $daysdiff = (integer)((strtotime($row["date"]) - strtotime($last_date)) / 86400);
95
+                $daysdiff = (integer) ((strtotime($row["date"]) - strtotime($last_date)) / 86400);
96 96
                 $daysstring = ($daysdiff == 1) ? "day" : "days";
97 97
                 $further = "";
98
-                if( $first_difference_output ) {
98
+                if ($first_difference_output) {
99 99
                     $first_difference_output = false;
100 100
                 } else {
101 101
                     $further = " a further";
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             $inner = "BUG: Unknown mention type $row[type]";
107 107
             $date = format_date($row['date'], SHORTDATEFORMAT);
108 108
             $url = $row['url'];
109
-            if ( strpos($url, 'business/businessBulletin') !== false ) {
109
+            if (strpos($url, 'business/businessBulletin') !== false) {
110 110
                 $url = str_replace('www.scottish', 'archive.scottish', $url);
111 111
             }
112 112
             switch ($row["type"]) {
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
                     $inner = "Mentioned in <a class=\"debate-speech__meta__link\" href=\"$url\">tabled written questions on $date</a>";
121 121
                     break;
122 122
                 case 4:
123
-                    if( preg_match('/^uk.org.publicwhip\/spq\/(.*)$/',$row['gid'],$m) ) {
123
+                    if (preg_match('/^uk.org.publicwhip\/spq\/(.*)$/', $row['gid'], $m)) {
124 124
                         $URL = new \MySociety\TheyWorkForYou\Url("spwrans");
125
-                        $URL->insert( array('spid' => $m[1]) );
125
+                        $URL->insert(array('spid' => $m[1]));
126 126
                         $relative_url = $URL->generate("none");
127 127
                         $inner = "Given a <a class=\"debate-speech__meta__link\" href=\"$relative_url\">written answer on $date</a>";
128 128
                     }
@@ -131,25 +131,25 @@  discard block
 block discarded – undo
131 131
                     $inner = "Given a holding answer on $date";
132 132
                     break;
133 133
                 case 6:
134
-                    if( preg_match('/^uk.org.publicwhip\/spor\/(.*)$/',$row['mentioned_gid'],$m) ) {
134
+                    if (preg_match('/^uk.org.publicwhip\/spor\/(.*)$/', $row['mentioned_gid'], $m)) {
135 135
                         $URL = new \MySociety\TheyWorkForYou\Url("spdebates");
136
-                        $URL->insert( array('id' => $m[1]) );
136
+                        $URL->insert(array('id' => $m[1]));
137 137
                         $relative_url = $URL->generate("none");
138 138
                         $inner = "<a href=\"$relative_url\">Asked in parliament on $date</a>";
139 139
                     }
140 140
                     break;
141 141
                 case 7:
142
-                    if( preg_match('/^uk.org.publicwhip\/spq\/(.*)$/',$row['mentioned_gid'],$m) ) {
142
+                    if (preg_match('/^uk.org.publicwhip\/spq\/(.*)$/', $row['mentioned_gid'], $m)) {
143 143
                         $referencing_spid = $m[1];
144 144
                         $URL = new \MySociety\TheyWorkForYou\Url("spwrans");
145
-                        $URL->insert( array('spid' => $referencing_spid) );
145
+                        $URL->insert(array('spid' => $referencing_spid));
146 146
                         $relative_url = $URL->generate("none");
147 147
                         $inner = "Referenced in <a href=\"$relative_url\">question $referencing_spid</a>";
148 148
                         $reference = true;
149 149
                     }
150 150
                     break;
151 151
             }
152
-            if( $reference ) {
152
+            if ($reference) {
153 153
                 $references[] = "\n<li>$inner.";
154 154
             } else {
155 155
                 $result .= "\n<li class=\"link-to-hansard\">$description$inner</span>";
Please login to merge, or discard this patch.
classes/SectionView/NiView.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     protected function getSearchSections() {
34 34
         return array(
35
-            array( 'section' => 'ni' )
35
+            array('section' => 'ni')
36 36
         );
37 37
     }
38 38
 
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
 
52 52
         $debates = $DEBATELIST->display('recent_debates', array('days' => 30, 'num' => 6), 'none');
53 53
         $MOREURL = new \MySociety\TheyWorkForYou\Url('nidebatesfront');
54
-        $MOREURL->insert( array( 'more' => 1 ) );
54
+        $MOREURL->insert(array('more' => 1));
55 55
 
56 56
         // this makes sure that we don't repeat this debate in the list below
57 57
         $random_debate = null;
58
-        if ( isset($debates['data']) && count($debates['data']) ) {
58
+        if (isset($debates['data']) && count($debates['data'])) {
59 59
             $random_debate = $debates['data'][0];
60 60
         }
61 61
 
62 62
         $recent = array();
63
-        if ( isset($debates['data']) && count($debates['data']) ) {
63
+        if (isset($debates['data']) && count($debates['data'])) {
64 64
             // at the start of a session there may be less than 6
65 65
             // debates
66 66
             $max = 6;
67
-            if ( count($debates['data']) < 6 ) {
67
+            if (count($debates['data']) < 6) {
68 68
                 $max = count($debates['data']);
69 69
             }
70
-            for ( $i = 1; $i < $max; $i++ ) {
70
+            for ($i = 1; $i < $max; $i++) {
71 71
                 $debate = $debates['data'][$i];
72 72
                 $debate['desc'] = "Northern Ireland Assembly debates";
73 73
                 $debate['more_url'] = $MOREURL->generate();
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         }
77 77
 
78 78
         $featured = array();
79
-        if ( $random_debate ) {
79
+        if ($random_debate) {
80 80
             $featured = $random_debate;
81 81
             $featured['more_url'] = $MOREURL->generate();
82 82
             $featured['desc'] = 'Northern Ireland Assembly debate';
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         }
86 86
 
87 87
         $data['featured'] = $featured;
88
-        $data['debates'] = array( 'recent' => $recent);
88
+        $data['debates'] = array('recent' => $recent);
89 89
 
90 90
         $data['regional'] = $this->getMLAList();
91 91
         $data['template'] = 'ni/index';
Please login to merge, or discard this patch.
classes/Office.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
             if ($this->source == 'chgpages/privsec' && $this->from_date == '2005-11-10') {
71 71
                 $output .= 'before ';
72 72
             }
73
-            $output .= format_date($this->from_date,SHORTDATEFORMAT) . ' ';
73
+            $output .= format_date($this->from_date, SHORTDATEFORMAT) . ' ';
74 74
         }
75 75
 
76 76
         $output .= 'to ';
Please login to merge, or discard this patch.
classes/FacebookLogin.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 
44 44
         try {
45 45
             $accessToken = $helper->getAccessToken();
46
-        } catch(\Facebook\Exceptions\FacebookResponseException $e) {
46
+        } catch (\Facebook\Exceptions\FacebookResponseException $e) {
47 47
             $data['error'] = 'Graph returned an error: ' . $e->getMessage();
48 48
             return $data;
49
-        } catch(\Facebook\Exceptions\FacebookSDKException $e) {
49
+        } catch (\Facebook\Exceptions\FacebookSDKException $e) {
50 50
             $data['error'] = 'Facebook SDK returned an error: ' . $e->getMessage();
51 51
             return $data;
52 52
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             return false;
68 68
         }
69 69
 
70
-        if (! $accessToken->isLongLived()) {
70
+        if (!$accessToken->isLongLived()) {
71 71
             $oAuth2Client = $this->getFacebookObject()->getOAuth2Client();
72 72
             try {
73 73
                 $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
Please login to merge, or discard this patch.
classes/Utility/Wikipedia.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -145,59 +145,59 @@
 block discarded – undo
145 145
 
146 146
     public static function antiTagInTag($content = '', $format = 'htmlhead')
147 147
     {
148
-      $tagend = -1;
149
-      for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) )
148
+        $tagend = -1;
149
+        for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) )
150 150
         {
151
-          // got the start of a tag.  Now find the proper end!
152
-          $walker = $tagstart + 1;
153
-          $open = 1;
154
-          while( $open != 0 && $walker < strlen( $content ) )
151
+            // got the start of a tag.  Now find the proper end!
152
+            $walker = $tagstart + 1;
153
+            $open = 1;
154
+            while( $open != 0 && $walker < strlen( $content ) )
155 155
         {
156
-          $nextopen = strpos( $content, '<', $walker );
157
-          $nextclose = strpos( $content, '>', $walker );
158
-          if( $nextclose === false ) {
159
-              // ERROR! Open waka without close waka!
160
-              // echo '<code>Error in antiTagInTag - malformed tag!</code> ';
161
-              return $content;
162
-          }
163
-          if( $nextopen === false || $nextopen > $nextclose ) {
164
-              // No more opens, but there was a close; or, a close happens before the next open.
165
-              // walker goes to the close+1, and open decrements
166
-              $open --;
167
-              $walker = $nextclose + 1;
168
-          } elseif( $nextopen < $nextclose ) {
169
-              // an open before the next close
170
-              $open ++;
171
-              $walker = $nextopen + 1;
172
-          }
156
+            $nextopen = strpos( $content, '<', $walker );
157
+            $nextclose = strpos( $content, '>', $walker );
158
+            if( $nextclose === false ) {
159
+                // ERROR! Open waka without close waka!
160
+                // echo '<code>Error in antiTagInTag - malformed tag!</code> ';
161
+                return $content;
162
+            }
163
+            if( $nextopen === false || $nextopen > $nextclose ) {
164
+                // No more opens, but there was a close; or, a close happens before the next open.
165
+                // walker goes to the close+1, and open decrements
166
+                $open --;
167
+                $walker = $nextclose + 1;
168
+            } elseif( $nextopen < $nextclose ) {
169
+                // an open before the next close
170
+                $open ++;
171
+                $walker = $nextopen + 1;
172
+            }
173 173
         }
174
-          $tagend = $walker;
175
-          if( $tagend > strlen( $content ) ) {
176
-              $tagend = strlen( $content );
177
-          } else {
178
-              $tagend --;
179
-              $tagstart ++;
180
-          }
181
-          $tag = substr( $content, $tagstart, $tagend - $tagstart );
182
-          $tags[] = '<' . $tag . '>';
183
-
184
-          if (function_exists('format_to_output')) {
174
+            $tagend = $walker;
175
+            if( $tagend > strlen( $content ) ) {
176
+                $tagend = strlen( $content );
177
+            } else {
178
+                $tagend --;
179
+                $tagstart ++;
180
+            }
181
+            $tag = substr( $content, $tagstart, $tagend - $tagstart );
182
+            $tags[] = '<' . $tag . '>';
183
+
184
+            if (function_exists('format_to_output')) {
185 185
             $newtag = format_to_output($tag, $format);
186
-          } else {
186
+            } else {
187 187
             $newtag = strip_tags($tag);
188
-          }
188
+            }
189 189
 
190
-          $newtags[] = '<' . $newtag . '>';
190
+            $newtags[] = '<' . $newtag . '>';
191 191
 
192
-          if (function_exists('format_to_output')) {
192
+            if (function_exists('format_to_output')) {
193 193
             $newtag = format_to_output($tag, $format);
194
-          } else {
194
+            } else {
195 195
             $newtag = strip_tags($tag);
196
-          }
196
+            }
197
+        }
198
+        if (isset($tags)&&isset($newtags)) {
199
+        $content = str_replace($tags, $newtags, $content);
197 200
         }
198
-      if (isset($tags)&&isset($newtags)) {
199
-      $content = str_replace($tags, $newtags, $content);
200
-      }
201 201
 
202 202
     return $content;
203 203
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
             twfy_debug("WIKIPEDIA", "Matched '$phrase'");
115 115
             # 1 means only replace one match for phrase per paragraph
116
-            $source = preg_replace ('{
116
+            $source = preg_replace('{
117 117
             \b(' . $phrase_re . ')\b # Match the phrase itself
118 118
             (?!                      # Match as long as the following does *not* apply:
119 119
                 (?:                  #   Match, possessively, as many strings of:
@@ -146,39 +146,39 @@  discard block
 block discarded – undo
146 146
     public static function antiTagInTag($content = '', $format = 'htmlhead')
147 147
     {
148 148
       $tagend = -1;
149
-      for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) )
149
+      for ($tagstart = strpos($content, '<', $tagend + 1); $tagstart !== false && $tagstart < strlen($content); $tagstart = strpos($content, '<', $tagend))
150 150
         {
151 151
           // got the start of a tag.  Now find the proper end!
152 152
           $walker = $tagstart + 1;
153 153
           $open = 1;
154
-          while( $open != 0 && $walker < strlen( $content ) )
154
+          while ($open != 0 && $walker < strlen($content))
155 155
         {
156
-          $nextopen = strpos( $content, '<', $walker );
157
-          $nextclose = strpos( $content, '>', $walker );
158
-          if( $nextclose === false ) {
156
+          $nextopen = strpos($content, '<', $walker);
157
+          $nextclose = strpos($content, '>', $walker);
158
+          if ($nextclose === false) {
159 159
               // ERROR! Open waka without close waka!
160 160
               // echo '<code>Error in antiTagInTag - malformed tag!</code> ';
161 161
               return $content;
162 162
           }
163
-          if( $nextopen === false || $nextopen > $nextclose ) {
163
+          if ($nextopen === false || $nextopen > $nextclose) {
164 164
               // No more opens, but there was a close; or, a close happens before the next open.
165 165
               // walker goes to the close+1, and open decrements
166
-              $open --;
166
+              $open--;
167 167
               $walker = $nextclose + 1;
168
-          } elseif( $nextopen < $nextclose ) {
168
+          } elseif ($nextopen < $nextclose) {
169 169
               // an open before the next close
170
-              $open ++;
170
+              $open++;
171 171
               $walker = $nextopen + 1;
172 172
           }
173 173
         }
174 174
           $tagend = $walker;
175
-          if( $tagend > strlen( $content ) ) {
176
-              $tagend = strlen( $content );
175
+          if ($tagend > strlen($content)) {
176
+              $tagend = strlen($content);
177 177
           } else {
178
-              $tagend --;
179
-              $tagstart ++;
178
+              $tagend--;
179
+              $tagstart++;
180 180
           }
181
-          $tag = substr( $content, $tagstart, $tagend - $tagstart );
181
+          $tag = substr($content, $tagstart, $tagend - $tagstart);
182 182
           $tags[] = '<' . $tag . '>';
183 183
 
184 184
           if (function_exists('format_to_output')) {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $newtag = strip_tags($tag);
196 196
           }
197 197
         }
198
-      if (isset($tags)&&isset($newtags)) {
198
+      if (isset($tags) && isset($newtags)) {
199 199
       $content = str_replace($tags, $newtags, $content);
200 200
       }
201 201
 
Please login to merge, or discard this patch.
classes/Utility/Search.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
                     $speakers[$pid]['office'][$moffice_id] = prettify_office($posn, $dept);
90 90
                 }
91 91
                 if (!isset($speakers[$pid]['name'])) {
92
-                    $speakers[$pid]['name'] = $full_name . ($house==1?' MP':'');
92
+                    $speakers[$pid]['name'] = $full_name . ($house == 1 ? ' MP' : '');
93 93
                 }
94
-                if ( !isset($speakers[$pid]['party']) && $party ) {
94
+                if (!isset($speakers[$pid]['party']) && $party) {
95 95
                     $speakers[$pid]['party'] = $party;
96 96
                 }
97 97
             }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      * Return query result from looking for MPs
145 145
      */
146 146
 
147
-    public static function searchMemberDbLookup($searchstring, $current_only=false) {
147
+    public static function searchMemberDbLookup($searchstring, $current_only = false) {
148 148
         if (!$searchstring) {
149 149
             return array();
150 150
         }
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
             // And here we're assuming the user's put the names in the right order.
159 159
             $params[':like_0'] = '%' . $searchwords[0] . '%';
160 160
             $params[':like_1'] = '%' . $searchwords[1] . '%';
161
-            $params[':like_0_and_1'] = '%' . $searchwords[0] . ' '. $searchwords[1] . '%';
162
-            $params[':like_0_and_1_hyphen'] = '%' . $searchwords[0] . '-'. $searchwords[1] . '%';
161
+            $params[':like_0_and_1'] = '%' . $searchwords[0] . ' ' . $searchwords[1] . '%';
162
+            $params[':like_0_and_1_hyphen'] = '%' . $searchwords[0] . '-' . $searchwords[1] . '%';
163 163
             $where = "(given_name LIKE :like_0 AND family_name LIKE :like_1)";
164 164
             $where .= " OR (given_name LIKE :like_1 AND family_name LIKE :like_0)";
165 165
             $where .= " OR (title LIKE :like_0 AND family_name LIKE :like_1)";
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
             $params[':like_0'] = '%' . $searchwords[0] . '%';
175 175
             $params[':like_1'] = '%' . $searchwords[1] . '%';
176 176
             $params[':like_2'] = '%' . $searchwords[2] . '%';
177
-            $params[':like_0_and_1'] = '%' . $searchwords[0] . ' '. $searchwords[1] . '%';
178
-            $params[':like_1_and_2'] = '%' . $searchwords[1] . ' '. $searchwords[2] . '%';
179
-            $params[':like_1_and_2_hyphen'] = '%' . $searchwords[1] . '-'. $searchwords[2] . '%';
177
+            $params[':like_0_and_1'] = '%' . $searchwords[0] . ' ' . $searchwords[1] . '%';
178
+            $params[':like_1_and_2'] = '%' . $searchwords[1] . ' ' . $searchwords[2] . '%';
179
+            $params[':like_1_and_2_hyphen'] = '%' . $searchwords[1] . '-' . $searchwords[2] . '%';
180 180
             $where = "(given_name LIKE :like_0_and_1 AND family_name LIKE :like_2)";
181 181
             $where .= " OR (given_name LIKE :like_0 AND family_name LIKE :like_1_and_2)";
182 182
             $where .= " OR (given_name LIKE :like_0 AND family_name LIKE :like_1_and_2_hyphen)";
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         return array_unique($pids);
206 206
     }
207 207
 
208
-    public static function searchMemberDbLookupWithNames($searchstring, $current_only=false) {
208
+    public static function searchMemberDbLookupWithNames($searchstring, $current_only = false) {
209 209
         $pids = self::searchMemberDbLookup($searchstring, $current_only);
210 210
 
211 211
         if (!count($pids)) {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             // Looks like a postcode - can we find the constituency?
255 255
             $constituency = Postcode::postcodeToConstituency($searchterm);
256 256
             if ($constituency) {
257
-                return array( array($constituency), true );
257
+                return array(array($constituency), true);
258 258
             }
259 259
         }
260 260
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             $constituencies[] = $row['name'];
273 273
         }
274 274
 
275
-        return array( $constituencies, false );
275
+        return array($constituencies, false);
276 276
     }
277 277
 
278 278
     /**
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $speakers = [];
289 289
 
290 290
         foreach ($criteria as $c) {
291
-            if (preg_match('#^speaker:(\d+)#',$c,$m)) {
291
+            if (preg_match('#^speaker:(\d+)#', $c, $m)) {
292 292
                 $MEMBER = new \MEMBER(array('person_id'=>$m[1]));
293 293
                 $speakers[$m[1]] = $MEMBER->full_name();
294 294
             }
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     public static function speakerIDsToNames($searchstring) {
308 308
         $speakers = self::speakerNamesForIDs($searchstring);
309 309
 
310
-        foreach ( $speakers as $id => $name ) {
310
+        foreach ($speakers as $id => $name) {
311 311
             $searchstring = str_replace('speaker:' . $id, "speaker:$name", $searchstring);
312 312
         }
313 313
 
Please login to merge, or discard this patch.
classes/PolicyPositions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param int $limit The number of results to limit the output to.
84 84
      */
85 85
 
86
-    private function getMemberPolicyPositions ($limit = null) {
86
+    private function getMemberPolicyPositions($limit = null) {
87 87
 
88 88
         // Make sure member info has actually been set.
89 89
         if (count($this->member->extra_info) === 0) {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
             // don't return votes where they haven't voted on a strong division
131 131
             // if we're limiting the number of votes
132
-            if ( $limit && !empty($dream_info) && !$dream_info['has_strong'] ) {
132
+            if ($limit && !empty($dream_info) && !$dream_info['has_strong']) {
133 133
                 continue;
134 134
             }
135 135
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                 $has_strong = 1;
209 209
             }
210 210
             $full_sentence = $consistency . ' ' . $policy_description;
211
-            $out = array( 'full_sentence' => $full_sentence, 'score' => $dmpscore, 'position' => $consistency, 'has_strong' => $has_strong );
211
+            $out = array('full_sentence' => $full_sentence, 'score' => $dmpscore, 'position' => $consistency, 'has_strong' => $has_strong);
212 212
         }
213 213
 
214 214
         return $out;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             # If not current MP/Lord, but current MLA/MSP, need to say voting record is when MP
240 240
             if (!$current_member[HOUSE_TYPE_COMMONS] and
241 241
                 !$current_member[HOUSE_TYPE_LORDS] and
242
-                ( $current_member[HOUSE_TYPE_SCOTLAND] or $current_member[HOUSE_TYPE_NI] )
242
+                ($current_member[HOUSE_TYPE_SCOTLAND] or $current_member[HOUSE_TYPE_NI])
243 243
             ) {
244 244
                 $since .= ' whilst an MP';
245 245
             }
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
                 '" title="At The Guardian">well-known issues</a> <small>(from the Guardian)</small>';
261 261
         }
262 262
         if (
263
-            ( isset($extra_info['public_whip_division_attendance']) and
264
-            $extra_info['public_whip_division_attendance'] != 'n/a' )
263
+            (isset($extra_info['public_whip_division_attendance']) and
264
+            $extra_info['public_whip_division_attendance'] != 'n/a')
265 265
             or
266
-            ( isset($extra_info['Lpublic_whip_division_attendance']) and
267
-            $extra_info['Lpublic_whip_division_attendance'] != 'n/a' )
266
+            (isset($extra_info['Lpublic_whip_division_attendance']) and
267
+            $extra_info['Lpublic_whip_division_attendance'] != 'n/a')
268 268
         ) {
269 269
             $record[] = '<a href="https://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' .
270 270
                 $this->member->member_id() .
Please login to merge, or discard this patch.