Passed
Push — master ( 4c090a...f12e7b )
by Struan
06:21
created
tests/SearchTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function testConstituencySearch() {
23 23
         $this->assertEquals(
24
-            [ [ 'Alyn and Deeside' ], false ],
24
+            [['Alyn and Deeside'], false],
25 25
             \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery('Alyn')
26 26
         );
27 27
         $this->assertEquals(
28
-            [ [ 'Alyn and Deeside' ], false ],
28
+            [['Alyn and Deeside'], false],
29 29
             \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery('Alyn and Deeside')
30 30
         );
31 31
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @group xapian
110 110
      */
111 111
     public function testSearchPage() {
112
-        $page = $this->fetch_page([ ]);
112
+        $page = $this->fetch_page([]);
113 113
         $this->assertStringContainsString('Search', $page);
114 114
     }
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      * @group xapian
120 120
      */
121 121
     public function testSearchPageMP() {
122
-        $page = $this->fetch_page([ 'q' => 'Mary Smith' ]);
122
+        $page = $this->fetch_page(['q' => 'Mary Smith']);
123 123
         $this->assertStringContainsString('Mary Smith', $page);
124 124
         $this->assertMatchesRegularExpression('/MP +for Amber Valley/', $page);
125 125
     }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      * @group xapian
131 131
      */
132 132
     public function testSearchPageMultipleMP() {
133
-        $page = $this->fetch_page([ 'q' => 'Jones' ]);
133
+        $page = $this->fetch_page(['q' => 'Jones']);
134 134
         $this->assertStringContainsString('People matching <em class="current-search-term">Jones</em>', $page);
135 135
         $this->assertStringContainsString('Andrew Jones', $page);
136 136
         $this->assertStringContainsString('Simon Jones', $page);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      * @group xapian
143 143
      */
144 144
     public function testSearchPageCons() {
145
-        $page = $this->fetch_page([ 'q' => 'Amber' ]);
145
+        $page = $this->fetch_page(['q' => 'Amber']);
146 146
         $this->assertStringContainsString('MP for <em class="current-search-term">Amber</em>', $page);
147 147
         $this->assertStringContainsString('Mary Smith', $page);
148 148
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      * @group xapian
155 155
      */
156 156
     public function testSearchPageConsWithNoMp() {
157
-        $page = $this->fetch_page([ 'q' => 'Alyn' ]);
157
+        $page = $this->fetch_page(['q' => 'Alyn']);
158 158
         $this->assertStringNotContainsString('MP for <em class="current-search-term">Alyn</em>', $page);
159 159
         $this->assertStringNotContainsString('MPs in constituencies matching', $page);
160 160
     }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @group xapian
167 167
      */
168 168
     public function testSearchPageMultipleCons() {
169
-        $page = $this->fetch_page([ 'q' => 'Liverpool' ]);
169
+        $page = $this->fetch_page(['q' => 'Liverpool']);
170 170
         $this->assertStringContainsString('MPs in constituencies matching <em class="current-search-term">Liverpool</em>', $page);
171 171
         $this->assertStringContainsString('Susan Brown', $page);
172 172
         $this->assertMatchesRegularExpression('/MP +for Liverpool, Riverside/', $page);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      * @group xapian
181 181
      */
182 182
     public function testSearchPageGlossary() {
183
-        $page = $this->fetch_page([ 'q' => 'other place' ]);
183
+        $page = $this->fetch_page(['q' => 'other place']);
184 184
         $this->assertStringContainsString('Glossary items matching', $page);
185 185
         $this->assertStringContainsString('<a href="/glossary/?gl=1">&ldquo;other place', $page);
186 186
     }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * @group xapian
192 192
      */
193 193
     public function testSearchPageSpellCorrect() {
194
-        $page = $this->fetch_page([ 'q' => 'plice' ]);
194
+        $page = $this->fetch_page(['q' => 'plice']);
195 195
         $this->assertStringContainsString('Did you mean <a href="/search/?q=place">place', $page);
196 196
     }
197 197
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      * @group xapian
202 202
      */
203 203
     public function testSearchBySpeakerNoResults() {
204
-        $page = $this->fetch_page([ 'q' => 'splice', 'o' => 'p' ]);
204
+        $page = $this->fetch_page(['q' => 'splice', 'o' => 'p']);
205 205
         $this->assertStringContainsString('Who says splice the most', $page);
206 206
         $this->assertStringContainsString('No results', $page);
207 207
     }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      * @group xapian
229 229
      */
230 230
     public function testSearchPageRSS() {
231
-        $page = $this->fetch_page([ 'q' => 'test' ]);
231
+        $page = $this->fetch_page(['q' => 'test']);
232 232
         $this->assertStringContainsString('<a href="/search/rss/?s=test">get an RSS feed', $page);
233 233
     }
234 234
 
Please login to merge, or discard this patch.
classes/Utility/Search.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             }
114 114
         }
115 115
 
116
-        uasort($speakers, function ($a, $b) {
116
+        uasort($speakers, function($a, $b) {
117 117
 
118 118
             if ($a['count'] > $b['count']) {
119 119
                 return -1;
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
             if ($mp_only) {
257 257
                 $constituency = Postcode::postcodeToConstituency($searchterm);
258 258
                 if ($constituency) {
259
-                    return [ [$constituency], true ];
259
+                    return [[$constituency], true];
260 260
                 }
261 261
             } else {
262 262
                 $constituencies = Postcode::postcodeToConstituencies($searchterm);
263 263
                 if ($constituencies) {
264
-                    return [ $constituencies, true ];
264
+                    return [$constituencies, true];
265 265
                 }
266 266
             }
267 267
         }
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             $constituencies[] = $row['name'];
281 281
         }
282 282
 
283
-        return [ $constituencies, false ];
283
+        return [$constituencies, false];
284 284
     }
285 285
 
286 286
     public static function searchMembersByConstituency($searchterm) {
Please login to merge, or discard this patch.
www/includes/easyparliament/glossary.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 include_once INCLUDESPATH . "easyparliament/searchengine.php";
25 25
 
26 26
 class GLOSSARY {
27
-    public $num_terms;			// how many glossary entries do we have
27
+    public $num_terms; // how many glossary entries do we have
28 28
     // (changes depending on how GLOSSARY is called
29
-    public $hansard_count;		// how many times does the phrase appear in hansard?
30
-    public $query;				// search term
31
-    public $glossary_id;		// if this is set then we only have 1 glossary term
32
-    public $current_term;		// will only be set if we have a valid epobject_id
29
+    public $hansard_count; // how many times does the phrase appear in hansard?
30
+    public $query; // search term
31
+    public $glossary_id; // if this is set then we only have 1 glossary term
32
+    public $current_term; // will only be set if we have a valid epobject_id
33 33
     public $current_letter;
34 34
 
35 35
     // constructor...
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
         // These stop stupid submissions.
74 74
         // everything should be lowercase.
75
-        $this->stopwords = [ "the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate" ];
75
+        $this->stopwords = ["the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate"];
76 76
 
77 77
     }
78 78
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         if ($return_expansions) {
366 366
             global $expansions;
367 367
             $expansions = [];
368
-            $body = preg_replace_callback($findwords, function ($matches) {
368
+            $body = preg_replace_callback($findwords, function($matches) {
369 369
                 global $expansions, $replacemap, $titlemap;
370 370
                 $lc_match = strtolower($matches[0]);
371 371
                 $expansions = $expansions + [$matches[0] => $titlemap[$lc_match]];
Please login to merge, or discard this patch.
classes/AlertView/Standard.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
             return;
467 467
         }
468 468
 
469
-        $cons_sort = function ($a, $b) {
469
+        $cons_sort = function($a, $b) {
470 470
             if ($a['rep_name'] == $b['rep_name']) {
471 471
                 if ($a['constituency'] == $b['constituency']) {
472 472
                     if ($a['member']->family_name == $b['member']->family_name) {
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
             foreach ($this->data['member_constituencies'] as $pid) {
544 544
                 try {
545 545
                     $MEMBER = new \MySociety\TheyWorkForYou\Member(['person_id' => $pid]);
546
-                    $cons[] = [ 'member' => $MEMBER, 'constituency' => $MEMBER->constituency, 'rep_name' => $MEMBER->getMostRecentMembership()['rep_name'] ];
546
+                    $cons[] = ['member' => $MEMBER, 'constituency' => $MEMBER->constituency, 'rep_name' => $MEMBER->getMostRecentMembership()['rep_name']];
547 547
                 } catch (\MySociety\TheyWorkForYou\MemberException $e) {
548 548
                     // do nothing
549 549
                 }
@@ -561,12 +561,12 @@  discard block
 block discarded – undo
561 561
                         $q = $db->query("SELECT person_id FROM member WHERE constituency = :constituency AND house = :house and left_reason = 'still_in_office'", [':constituency' => $constituency, ':house' => $house]);
562 562
                         foreach ($q as $row) {
563 563
                             $MEMBER = new \MySociety\TheyWorkForYou\Member(['person_id' => $row['person_id'], 'house' => $house]);
564
-                            $cons[] = [ 'member' => $MEMBER, 'constituency' => $constituency, 'rep_name' => $MEMBER->getMostRecentMembership()['rep_name'] ];
564
+                            $cons[] = ['member' => $MEMBER, 'constituency' => $constituency, 'rep_name' => $MEMBER->getMostRecentMembership()['rep_name']];
565 565
                         }
566 566
 
567 567
                     } else {
568 568
                         $MEMBER = new \MySociety\TheyWorkForYou\Member(['constituency' => $constituency, 'house' => $house]);
569
-                        $cons[] = [ 'member' => $MEMBER, 'constituency' => $constituency ];
569
+                        $cons[] = ['member' => $MEMBER, 'constituency' => $constituency];
570 570
                     }
571 571
                 } catch (\MySociety\TheyWorkForYou\MemberException $e) {
572 572
                     // do nothing
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
                 if ($this->data['pid']) {
733 733
                     $criteria .= " speaker:" . $this->data['pid'];
734 734
                 }
735
-                $this->data['search_results']  = $this->getRecentResults($criteria);
735
+                $this->data['search_results'] = $this->getRecentResults($criteria);
736 736
             }
737 737
 
738 738
             $this->data['criteria'] = $criteria;
Please login to merge, or discard this patch.