Passed
Pull Request — master (#1428)
by Nick
06:09
created
tests/SearchTest.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 
8 8
 class SearchTest extends FetchPageTestCase
9 9
 {
10
-	public function setUp()
11
-	{
10
+    public function setUp()
11
+    {
12 12
         parent::setUp();
13 13
         include_once('www/includes/easyparliament/searchengine.php');
14 14
     }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      *
88 88
      * @group xapian
89 89
      */
90
-	public function testSearchNormal()
90
+    public function testSearchNormal()
91 91
     {
92 92
         $SEARCHENGINE = new SEARCHENGINE('test');
93 93
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      *
103 103
      * @group xapian
104 104
      */
105
-	public function testSearchLink()
105
+    public function testSearchLink()
106 106
     {
107 107
         $SEARCHENGINE = new SEARCHENGINE('test');
108 108
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
     public function testConstituencySearch()
27 27
     {
28 28
         $this->assertEquals(
29
-            array( array( 'Alyn and Deeside' ), false ),
29
+            array(array('Alyn and Deeside'), false),
30 30
             \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery('Alyn')
31 31
         );
32 32
         $this->assertEquals(
33
-            array( array( 'Alyn and Deeside' ), false ),
33
+            array(array('Alyn and Deeside'), false),
34 34
             \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery('Alyn and Deeside')
35 35
         );
36 36
     }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function testSearchPage()
121 121
     {
122
-        $page = $this->fetch_page( array( ) );
122
+        $page = $this->fetch_page(array( ));
123 123
         $this->assertContains('Search', $page);
124 124
     }
125 125
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function testSearchPageMP()
132 132
     {
133
-        $page = $this->fetch_page( array( 'q' => 'Mary Smith' ) );
133
+        $page = $this->fetch_page(array('q' => 'Mary Smith'));
134 134
         $this->assertContains('Mary Smith', $page);
135 135
         $this->assertContains('MP, Amber Valley', $page);
136 136
     }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function testSearchPageMultipleMP()
144 144
     {
145
-        $page = $this->fetch_page( array( 'q' => 'Jones' ) );
145
+        $page = $this->fetch_page(array('q' => 'Jones'));
146 146
         $this->assertContains('People matching <em class="current-search-term">Jones</em>', $page);
147 147
         $this->assertContains('Andrew Jones', $page);
148 148
         $this->assertContains('Simon Jones', $page);
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      * @group xapian
155 155
      */
156 156
     public function testSearchPageCons() {
157
-        $page = $this->fetch_page( array( 'q' => 'Amber' ) );
157
+        $page = $this->fetch_page(array('q' => 'Amber'));
158 158
         $this->assertContains('MP for <em class="current-search-term">Amber</em>', $page);
159 159
         $this->assertContains('Mary Smith', $page);
160 160
     }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @group xapian
167 167
      */
168 168
     public function testSearchPageConsWithNoMp() {
169
-        $page = $this->fetch_page( array( 'q' => 'Alyn' ) );
169
+        $page = $this->fetch_page(array('q' => 'Alyn'));
170 170
         $this->assertNotContains('MP for <em class="current-search-term">Alyn</em>', $page);
171 171
         $this->assertNotContains('MPs in constituencies matching', $page);
172 172
     }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @group xapian
179 179
      */
180 180
     public function testSearchPageMultipleCons() {
181
-        $page = $this->fetch_page( array( 'q' => 'Liverpool' ) );
181
+        $page = $this->fetch_page(array('q' => 'Liverpool'));
182 182
         $this->assertContains('MPs in constituencies matching <em class="current-search-term">Liverpool</em>', $page);
183 183
         $this->assertContains('Susan Brown', $page);
184 184
         $this->assertContains('MP, Liverpool, Riverside', $page);
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      * @group xapian
193 193
      */
194 194
     public function testSearchPageGlossary() {
195
-        $page = $this->fetch_page( array( 'q' => 'other place' ) );
195
+        $page = $this->fetch_page(array('q' => 'other place'));
196 196
         $this->assertContains('Glossary items matching', $page);
197 197
         $this->assertContains('<a href="/glossary/?gl=1">&ldquo;other place', $page);
198 198
     }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      * @group xapian
204 204
      */
205 205
     public function testSearchPageSpellCorrect() {
206
-        $page = $this->fetch_page( array( 'q' => 'plice' ) );
206
+        $page = $this->fetch_page(array('q' => 'plice'));
207 207
         $this->assertContains('Did you mean <a href="/search/?q=place">place', $page);
208 208
     }
209 209
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      * @group xapian
214 214
      */
215 215
     public function testSearchBySpeakerNoResults() {
216
-        $page = $this->fetch_page( array( 'q' => 'splice', 'o' => 'p' ) );
216
+        $page = $this->fetch_page(array('q' => 'splice', 'o' => 'p'));
217 217
         $this->assertContains('Who says splice the most', $page);
218 218
         $this->assertContains('No results', $page);
219 219
     }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      * @group xapian
241 241
      */
242 242
     public function testSearchPageRSS() {
243
-        $page = $this->fetch_page( array( 'q' => 'test' ) );
243
+        $page = $this->fetch_page(array('q' => 'test'));
244 244
         $this->assertContains('<a href="/search/rss/?s=test">get an RSS feed', $page);
245 245
     }
246 246
 
Please login to merge, or discard this patch.
classes/Renderer.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,12 +84,12 @@
 block discarded – undo
84 84
         // Require the templates and output
85 85
 
86 86
         if ($template_only) {
87
-          require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php';
87
+            require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php';
88 88
         } else {
89
-          header('Content-Type: text/html; charset=utf-8');
90
-          require_once INCLUDESPATH . 'easyparliament/templates/html/header.php';
91
-          require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php';
92
-          require_once INCLUDESPATH . 'easyparliament/templates/html/footer.php';
89
+            header('Content-Type: text/html; charset=utf-8');
90
+            require_once INCLUDESPATH . 'easyparliament/templates/html/header.php';
91
+            require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php';
92
+            require_once INCLUDESPATH . 'easyparliament/templates/html/footer.php';
93 93
         }
94 94
     }
95 95
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $user = new Renderer\User();
44 44
         $data = array_merge($user->data, $data);
45 45
 
46
-        if ( isset($page_errors) ) {
46
+        if (isset($page_errors)) {
47 47
             $data['page_errors'] = $page_errors;
48 48
         }
49 49
 
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 
96 96
     private static function addCommonURLs($data) {
97 97
         $urls = array();
98
-        if ( isset($data['urls']) ) {
98
+        if (isset($data['urls'])) {
99 99
             $urls = $data['urls'];
100 100
         }
101 101
 
102 102
         $common_urls = array('search', 'alert');
103 103
 
104
-        foreach ( $common_urls as $path ) {
105
-            if (!isset($urls[$path]) ) {
104
+        foreach ($common_urls as $path) {
105
+            if (!isset($urls[$path])) {
106 106
                 $url = new Url($path);
107 107
                 $urls[$path] = $url->generate();
108 108
             }
Please login to merge, or discard this patch.
classes/AlertView/Standard.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -127,7 +127,9 @@
 block discarded – undo
127 127
         }
128 128
 
129 129
         $text = $this->data['alertsearch'];
130
-        if (!$text) $text = $this->data['keyword'];
130
+        if (!$text) {
131
+            $text = $this->data['keyword'];
132
+        }
131 133
 
132 134
         if ($this->data['submitted'] && !$this->data['pid'] && !$text) {
133 135
             $errors['alertsearch'] = 'Please enter what you want to be alerted about';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 class Standard extends \MySociety\TheyWorkForYou\AlertView {
13 13
     public $data;
14 14
 
15
-    public function __construct($THEUSER = NULL) {
15
+    public function __construct($THEUSER = null) {
16 16
         parent::__construct($THEUSER);
17 17
         $this->data = array();
18 18
     }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                 try {
178 178
                     $MEMBER = new \MEMBER(array('constituency'=>$constituency, 'house' => 1));
179 179
                     $cons[$constituency] = $MEMBER;
180
-                } catch ( \MySociety\TheyWorkForYou\MemberException $e ) {
180
+                } catch (\MySociety\TheyWorkForYou\MemberException $e) {
181 181
                     // do nothing
182 182
                 }
183 183
             }
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
 
198 198
         // If this goes well, the alert will be added to the database and a confirmation email
199 199
         // will be sent to them.
200
-        $success = $this->alert->add( $this->data, $confirm );
200
+        $success = $this->alert->add($this->data, $confirm);
201 201
 
202
-        if ($success>0 && !$confirm) {
202
+        if ($success > 0 && !$confirm) {
203 203
             $result = 'alert-added';
204
-        } elseif ($success>0) {
204
+        } elseif ($success > 0) {
205 205
             $result = 'alert-confirmation';
206 206
         } elseif ($success == -2) {
207 207
             // we need to make sure we know that the person attempting to sign up
208 208
             // for the alert has that email address to stop people trying to work
209 209
             // out what alerts they are signed up to
210
-            if ( $this->data['email_verified'] || ( $this->user->loggedin && $this->user->email() == $this->data['email'] ) ) {
210
+            if ($this->data['email_verified'] || ($this->user->loggedin && $this->user->email() == $this->data['email'])) {
211 211
                 $result = 'alert-exists';
212 212
             } else {
213 213
                 // don't throw an error message as that implies that they have already signed
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
 
234 234
     private function formatSearchTerms() {
235
-        if ( $this->data['alertsearch'] ) {
235
+        if ($this->data['alertsearch']) {
236 236
             $this->data['alertsearch_pretty'] = \MySociety\TheyWorkForYou\Utility\Alert::prettifyCriteria($this->data['alertsearch']);
237 237
             $this->data['search_text'] = $this->data['alertsearch'];
238 238
         } else {
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
     }
266 266
 
267 267
     private function formatSearchMemberData() {
268
-        if ( isset($this->data['postcode']) ) {
268
+        if (isset($this->data['postcode'])) {
269 269
             try {
270 270
                 $postcode = $this->data['postcode'];
271 271
 
272
-                $MEMBER = new \MEMBER( array('postcode' => $postcode) );
272
+                $MEMBER = new \MEMBER(array('postcode' => $postcode));
273 273
                 // move the postcode to the front just to be tidy
274 274
                 $tidy_alertsearch = $postcode . " " . trim(str_replace("$postcode", "", $this->data['alertsearch']));
275 275
                 $alertsearch_display = str_replace("$postcode ", "", $tidy_alertsearch);
@@ -278,25 +278,25 @@  discard block
 block discarded – undo
278 278
                 $this->data['member_displaysearch'] = $alertsearch_display;
279 279
                 $this->data['member'] = $MEMBER;
280 280
 
281
-                if ( $this->data['scottish_text'] ) {
281
+                if ($this->data['scottish_text']) {
282 282
                     $constituencies = \MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituencies($postcode);
283
-                    if ( isset($constituencies['SPC']) ) {
283
+                    if (isset($constituencies['SPC'])) {
284 284
                         $MEMBER = new \MEMBER(array('constituency' => $constituencies['SPC'], 'house' => 4));
285 285
                         $this->data['scottish_alertsearch'] = str_replace("$postcode", "speaker:" . $MEMBER->person_id, $tidy_alertsearch);
286 286
                         $this->data['scottish_member'] = $MEMBER;
287 287
                     }
288 288
                 }
289
-            } catch ( \MySociety\TheyWorkForYou\MemberException $e ) {
289
+            } catch (\MySociety\TheyWorkForYou\MemberException $e) {
290 290
                 $this->data['member_error'] = 1;
291 291
             }
292 292
         }
293 293
 
294
-        if ( $this->data['pid'] ) {
295
-            $MEMBER = new \MEMBER( array('person_id' => $this->data['pid']) );
294
+        if ($this->data['pid']) {
295
+            $MEMBER = new \MEMBER(array('person_id' => $this->data['pid']));
296 296
             $this->data['pid_member'] = $MEMBER;
297 297
         }
298 298
 
299
-        if ( $this->data['keyword'] ) {
299
+        if ($this->data['keyword']) {
300 300
             $this->data['display_keyword'] = \MySociety\TheyWorkForYou\Utility\Alert::prettifyCriteria($this->data['keyword']);
301 301
         }
302 302
     }
Please login to merge, or discard this patch.
classes/Renderer/Header.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     private function get_page_url() {
50 50
         $protocol = 'https://';
51 51
         if (DEVSITE) {
52
-          $protocol = 'http://';
52
+            $protocol = 'http://';
53 53
         }
54 54
         $url = $protocol . DOMAIN;
55 55
         if (array_key_exists('REQUEST_URI', $_SERVER)) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         if (isset($nextprev[$linktype]) && isset($nextprev[$linktype]['url'])) {
136 136
 
137 137
             if (isset($nextprev[$linktype]['body'])) {
138
-                $linktitle = _htmlentities( trim_characters($nextprev[$linktype]['body'], 0, 40) );
138
+                $linktitle = _htmlentities(trim_characters($nextprev[$linktype]['body'], 0, 40));
139 139
                 if (isset($nextprev[$linktype]['speaker']) &&
140 140
                     count($nextprev[$linktype]['speaker']) > 0) {
141 141
                     $linktitle = $nextprev[$linktype]['speaker']['name'] . ': ' . $linktitle;
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 
163 163
         if ($nextprev) {
164 164
             // Four different kinds of back/forth links we might build.
165
-            $links = array ("first", "prev", "up", "next", "last");
165
+            $links = array("first", "prev", "up", "next", "last");
166 166
 
167 167
             foreach ($links as $type) {
168
-                if ( $link = $this->generate_next_prev_link( $nextprev, $type ) ) {
168
+                if ($link = $this->generate_next_prev_link($nextprev, $type)) {
169 169
 
170 170
                     $this->data['header_links'][] = $link;
171 171
                 }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         // Page names mapping to those in metadata.php.
259 259
         // Links in the top menu, and the sublinks we see if
260 260
         // we're within that section.
261
-        $nav_items = array (
261
+        $nav_items = array(
262 262
             array('home'),
263 263
             array('hansard', 'mps', 'peers', 'alldebatesfront', 'wranswmsfront', 'pbc_front', 'divisions_recent', 'calendar_summary'),
264 264
             array('sp_home', 'spoverview', 'msps', 'spdebatesfront', 'spwransfront'),
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,7 +81,9 @@  discard block
 block discarded – undo
81 81
 
82 82
             $parent_page = $DATA->page_metadata($this_page, 'parent');
83 83
             if ($parent_title = $DATA->page_metadata($parent_page, 'title')) {
84
-                if ($this->data['page_title']) $this->data['page_title'] .= ': ';
84
+                if ($this->data['page_title']) {
85
+                    $this->data['page_title'] .= ': ';
86
+                }
85 87
                 $this->data['page_title'] .= $parent_title;
86 88
             }
87 89
 
@@ -103,7 +105,9 @@  discard block
 block discarded – undo
103 105
         // Meta keywords
104 106
         if (!$this->data['meta_keywords'] = $DATA->page_metadata($this_page, "meta_keywords")) {
105 107
             $this->data['meta_keywords'] = $this->keywords_title;
106
-            if ($this->data['meta_keywords']) $this->data['meta_keywords'] .= ', ';
108
+            if ($this->data['meta_keywords']) {
109
+                $this->data['meta_keywords'] .= ', ';
110
+            }
107 111
             $this->data['meta_keywords'] .= 'Hansard, Official Report, Parliament, government, House of Commons, House of Lords, MP, Peer, Member of Parliament, MPs, Peers, Lords, Commons, Scottish Parliament, Northern Ireland Assembly, MSP, MLA, MSPs, MLAs';
108 112
         }
109 113
 
@@ -204,7 +208,9 @@  discard block
 block discarded – undo
204 208
             $p = $parent;
205 209
             while ($p) {
206 210
                 $p = $DATA->page_metadata($p, 'parent');
207
-                if ($p) $parents[] = $p;
211
+                if ($p) {
212
+                    $parents[] = $p;
213
+                }
208 214
             }
209 215
 
210 216
             $top_highlight = array_pop($parents);
@@ -279,7 +285,9 @@  discard block
 block discarded – undo
279 285
             $menudata = $DATA->page_metadata($toppage, 'menu');
280 286
             $text = $menudata['text'];
281 287
             $title = $menudata['title'];
282
-            if (!$title) continue;
288
+            if (!$title) {
289
+                continue;
290
+            }
283 291
 
284 292
             //get link and description for the menu ans add it to the array
285 293
             $class = $toppage == $this->nav_highlights['top'] ? 'on' : '';
Please login to merge, or discard this patch.
classes/Renderer/Footer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
     public $data;
16 16
 
17
-    private $about_links = array ('help', 'about', 'linktous', 'houserules', 'blog', 'news', 'contact', 'privacy');
17
+    private $about_links = array('help', 'about', 'linktous', 'houserules', 'blog', 'news', 'contact', 'privacy');
18 18
     private $assemblies_links = array('hansard', 'sp_home', 'ni_home', 'wales_home');
19 19
     private $international_links = array('newzealand', 'australia', 'ireland', 'mzalendo');
20 20
     private $tech_links = array('code', 'api', 'data', 'pombola', 'devmailinglist', 'irc');
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
     public function __construct() {
29 29
         $this->data = array();
30 30
 
31
-        $this->data['about'] = $this->get_menu_links( $this->about_links );
32
-        $this->data['assemblies'] = $this->get_menu_links( $this->assemblies_links );
33
-        $this->data['international'] = $this->get_menu_links( $this->international_links );
34
-        $this->data['tech'] = $this->get_menu_links( $this->tech_links );
31
+        $this->data['about'] = $this->get_menu_links($this->about_links);
32
+        $this->data['assemblies'] = $this->get_menu_links($this->assemblies_links);
33
+        $this->data['international'] = $this->get_menu_links($this->international_links);
34
+        $this->data['tech'] = $this->get_menu_links($this->tech_links);
35 35
     }
36 36
 
37 37
     /**
Please login to merge, or discard this patch.
classes/Office.php 4 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
     public $source;
20 20
 
21 21
     /**
22
-    * To String
23
-    *
24
-    * Return the office title as a string.
25
-    *
26
-    * @return string The title of the office, or "Unnamed Office"
27
-    */
22
+     * To String
23
+     *
24
+     * Return the office title as a string.
25
+     *
26
+     * @return string The title of the office, or "Unnamed Office"
27
+     */
28 28
 
29 29
     public function __toString() {
30 30
         if (isset ($this->title)){
@@ -35,25 +35,25 @@  discard block
 block discarded – undo
35 35
     }
36 36
 
37 37
     /**
38
-    * Pretty Dates
39
-    *
40
-    * Return a string containing prettified dates of this office.
41
-    *
42
-    * 2004-05-28 and 2004-05-13 are the first dates for data scraped from the
43
-    * old selctee/privsec pages on parliament.uk (you can see this in
44
-    * cmpages/chgpages' privsec0001_2004-06-08.html and
45
-    * selctee0001_2004-06-08.html). So if the date is those dates for those two
46
-    * things, you don't want to display it because it's not a known start date,
47
-    * it could have been before that date. 2005-11-10 is because the PPS changes
48
-    * did not all happen on that date but the website did not update until that
49
-    * date so it outputs "before" in either from/to date in that case.
50
-    * 2009-01-16 is the last date before the page disappeared off parliament.uk
51
-    * entirely so that displays that fact that after then we don't know.
52
-    *
53
-    * @todo https://github.com/mysociety/theyworkforyou/issues/632
54
-    *
55
-    * @return string The dates of this office in a readable form.
56
-    */
38
+     * Pretty Dates
39
+     *
40
+     * Return a string containing prettified dates of this office.
41
+     *
42
+     * 2004-05-28 and 2004-05-13 are the first dates for data scraped from the
43
+     * old selctee/privsec pages on parliament.uk (you can see this in
44
+     * cmpages/chgpages' privsec0001_2004-06-08.html and
45
+     * selctee0001_2004-06-08.html). So if the date is those dates for those two
46
+     * things, you don't want to display it because it's not a known start date,
47
+     * it could have been before that date. 2005-11-10 is because the PPS changes
48
+     * did not all happen on that date but the website did not update until that
49
+     * date so it outputs "before" in either from/to date in that case.
50
+     * 2009-01-16 is the last date before the page disappeared off parliament.uk
51
+     * entirely so that displays that fact that after then we don't know.
52
+     *
53
+     * @todo https://github.com/mysociety/theyworkforyou/issues/632
54
+     *
55
+     * @return string The dates of this office in a readable form.
56
+     */
57 57
 
58 58
     public function pretty_dates() {
59 59
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
         $output = '';
65 65
 
66 66
         if (
67
-            !($this->source == 'chgpages/selctee' && $this->from_date == '2004-05-28') AND
67
+            !($this->source == 'chgpages/selctee' && $this->from_date == '2004-05-28') and
68 68
             !($this->source == 'chgpages/privsec' && $this->from_date == '2004-05-13')
69 69
         ) {
70 70
             if ($this->source == 'chgpages/privsec' && $this->from_date == '2005-11-10') {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     */
28 28
 
29 29
     public function __toString() {
30
-        if (isset ($this->title)){
30
+        if (isset ($this->title)) {
31 31
             return (string) $this->title;
32 32
         } else {
33 33
             return 'Unnamed Office';
@@ -70,7 +70,7 @@  discard block
 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.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     */
28 28
 
29 29
     public function __toString() {
30
-        if (isset ($this->title)){
30
+        if (isset ($this->title)) {
31 31
             return (string) $this->title;
32 32
         } else {
33 33
             return 'Unnamed Office';
Please login to merge, or discard this patch.
classes/Search/Normal.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,9 @@
 block discarded – undo
141 141
 
142 142
     private function find_members() {
143 143
         $searchstring = trim(preg_replace('#-?[a-z]+:[a-z0-9]+#', '', $this->searchstring));
144
-        if (!$searchstring) return array();
144
+        if (!$searchstring) {
145
+            return array();
146
+        }
145 147
 
146 148
         $members = array();
147 149
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
         }
13 13
 
14 14
         $o = get_http_var('o');
15
-        $args = array (
15
+        $args = array(
16 16
             's' => $this->searchstring,
17 17
             'p' => $pagenum,
18 18
             'num' => get_http_var('num'),
19 19
             'pop' => get_http_var('pop'),
20
-            'o' => ($o=='d' || $o=='r' || $o=='o') ? $o : 'd',
20
+            'o' => ($o == 'd' || $o == 'r' || $o == 'o') ? $o : 'd',
21 21
         );
22 22
 
23 23
         return $args;
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
         }
56 56
 
57 57
         $sort_order = 'newest';
58
-        if ( $args['o'] == 'o' ) {
58
+        if ($args['o'] == 'o') {
59 59
             $sort_order = 'oldest';
60
-        } else if ( $args['o'] == 'r' ) {
60
+        } else if ($args['o'] == 'r') {
61 61
             $sort_order = 'relevance';
62 62
         }
63 63
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             return array('error' => $SEARCHENGINE->error);
74 74
         } else {
75 75
             $LIST = new \HANSARDLIST();
76
-            $data = $LIST->display('search', $args , 'none');
76
+            $data = $LIST->display('search', $args, 'none');
77 77
             $data['search_type'] = 'normal';
78 78
             $data['sort_order'] = $sort_order;
79 79
             $data['members'] = $members;
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
             return false;
94 94
         }
95 95
 
96
-        list ($constituencies, ) = \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery($searchterm);
96
+        list ($constituencies,) = \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery($searchterm);
97 97
 
98 98
         $constituency = "";
99
-        if (count($constituencies)==1) {
99
+        if (count($constituencies) == 1) {
100 100
             $constituency = $constituencies[0];
101 101
         }
102 102
 
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 
113 113
                 $MEMBER = new \MySociety\TheyWorkForYou\Member(array('constituency'=>$constituency, 'house' => 1));
114 114
                 $cons[] = $MEMBER;
115
-                if ( $MEMBER->current_member(1) ) {
115
+                if ($MEMBER->current_member(1)) {
116 116
                     $mp_types['mp']++;
117 117
                 } else {
118 118
                     $mp_types['former']++;
119 119
                 }
120
-            } catch ( \MySociety\TheyWorkForYou\MemberException $e ) {
120
+            } catch (\MySociety\TheyWorkForYou\MemberException $e) {
121 121
                 $cons = array();
122 122
             }
123 123
         } elseif (count($constituencies)) {
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
                 try {
126 126
                     $MEMBER = new \MySociety\TheyWorkForYou\Member(array('constituency'=>$constituency, 'house' => 1));
127 127
                     $cons[] = $MEMBER;
128
-                    if ( $MEMBER->current_member(1) ) {
128
+                    if ($MEMBER->current_member(1)) {
129 129
                         $mp_types['mp']++;
130 130
                     } else {
131 131
                         $mp_types['former']++;
132 132
                     }
133
-                } catch ( \MySociety\TheyWorkForYou\MemberException $e ) {
133
+                } catch (\MySociety\TheyWorkForYou\MemberException $e) {
134 134
                     continue;
135 135
                 }
136 136
             }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             $link = array(
202 202
                 'url' => $url->generate(),
203 203
                 'page' => $n,
204
-                'current' => ( $n == $data['page'] )
204
+                'current' => ($n == $data['page'])
205 205
             );
206 206
 
207 207
             $links[] = $link;
@@ -242,27 +242,27 @@  discard block
 block discarded – undo
242 242
             $numlinks = $this->generate_pagination_links($data, $URL, $firstpage, $lastpage);
243 243
 
244 244
             $pagelinks['nums'] = $numlinks;
245
-            $pagelinks['first_result'] = $page == 1 ? 1 : ( ( $page - 1 ) * $results_per_page ) + 1;
246
-            $pagelinks['last_result'] = $page == $numpages ? $total_results : $pagelinks['first_result'] + ( $results_per_page - 1 );
245
+            $pagelinks['first_result'] = $page == 1 ? 1 : (($page - 1) * $results_per_page) + 1;
246
+            $pagelinks['last_result'] = $page == $numpages ? $total_results : $pagelinks['first_result'] + ($results_per_page - 1);
247 247
 
248
-            if ( $page != 1 ) {
248
+            if ($page != 1) {
249 249
                 $prev_page = $page - 1;
250
-                $URL->insert(array( 'p' => $prev_page ) );
250
+                $URL->insert(array('p' => $prev_page));
251 251
                 $pagelinks['prev'] = array(
252 252
                     'url' => $URL->generate()
253 253
                 );
254
-                $URL->insert(array( 'p' => 1 ) );
254
+                $URL->insert(array('p' => 1));
255 255
                 $pagelinks['firstpage'] = array(
256 256
                     'url' => $URL->generate()
257 257
                 );
258 258
             }
259 259
             if ($page != $numpages) {
260 260
                 $next_page = $page + 1;
261
-                $URL->insert(array( 'p' => $next_page ) );
261
+                $URL->insert(array('p' => $next_page));
262 262
                 $pagelinks['next'] = array(
263 263
                     'url' => $URL->generate()
264 264
                 );
265
-                $URL->insert(array( 'p' => $numpages ) );
265
+                $URL->insert(array('p' => $numpages));
266 266
                 $pagelinks['lastpage'] = array(
267 267
                     'url' => $URL->generate()
268 268
                 );
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         $links['rss'] = $DATA->page_metadata($this_page, 'rss');
280 280
 
281 281
         if ($SEARCHENGINE) {
282
-            $links['email'] = '/alert/?' . ($this->searchstring ? 'alertsearch='.urlencode($this->searchstring) : '');
282
+            $links['email'] = '/alert/?' . ($this->searchstring ? 'alertsearch=' . urlencode($this->searchstring) : '');
283 283
             $links['email_desc'] = $SEARCHENGINE->query_description_long();
284 284
         }
285 285
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
             $search_engine = new \SEARCHENGINE($filter_ss);
294 294
             $links['email_section'] = $links['email'];
295 295
             $links['email_desc_section'] = $links['email_desc'];
296
-            $links['email'] = '/alert/?' . ($filter_ss ? 'alertsearch='.urlencode($filter_ss) : '');
296
+            $links['email'] = '/alert/?' . ($filter_ss ? 'alertsearch=' . urlencode($filter_ss) : '');
297 297
             $links['email_desc'] = $search_engine->query_description_long();
298 298
         }
299 299
 
Please login to merge, or discard this patch.
classes/SectionView/SpView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
     protected function getSearchSections() {
26 26
         return array(
27
-            array( 'section' => 'sp' )
27
+            array('section' => 'sp')
28 28
         );
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
classes/SectionView/WransView.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
 
13 13
     protected function display_front() {
14 14
         global $DATA, $this_page;
15
-        if ( get_http_var('type') == 'wrans') {
15
+        if (get_http_var('type') == 'wrans') {
16 16
             return parent::display_front();
17 17
         }
18 18
 
19 19
         $data = array();
20 20
 
21
-        $args = array( 'months' => 1 );
21
+        $args = array('months' => 1);
22 22
         $WRANSLIST = new \WRANSLIST;
23 23
 
24 24
         $wrans = array();
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 
51 51
     protected function getSearchSections() {
52 52
         $sections = array(
53
-            array( 'section' => 'wrans', 'title' => 'Written Answers' ),
53
+            array('section' => 'wrans', 'title' => 'Written Answers'),
54 54
         );
55
-        if ( get_http_var('type') == '') {
56
-            $sections[] = array( 'section' => 'wms', 'title' => 'Written Ministerial Statements' );
55
+        if (get_http_var('type') == '') {
56
+            $sections[] = array('section' => 'wms', 'title' => 'Written Ministerial Statements');
57 57
         }
58 58
         return $sections;
59 59
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     # speech bar the first (assuming that's the question)
63 63
     private $votelinks_so_far = 0;
64 64
 
65
-    protected function generate_votes ($votes, $id, $gid) {
65
+    protected function generate_votes($votes, $id, $gid) {
66 66
         /*
67 67
         Returns HTML for the 'Does this answer the question?' links (wrans) in the sidebar.
68 68
         $votes = => array (
Please login to merge, or discard this patch.