Passed
Push — master ( 9b6994...2073b4 )
by Struan
17:27
created
classes/Search.php 2 patches
Switch Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -82,42 +82,42 @@
 block discarded – undo
82 82
     private function prettify_search_section($section) {
83 83
         $name = '';
84 84
         switch ($section) {
85
-        case 'wrans':
86
-            $name = 'Written Answers';
87
-            break;
88
-        case 'uk':
89
-            $name = 'All UK';
90
-            break;
91
-        case 'debates':
92
-            $name = 'House of Commons debates';
93
-            break;
94
-        case 'whall':
95
-            $name = 'Westminster Hall debates';
96
-            break;
97
-        case 'lords':
98
-            $name = 'House of Lords debates';
99
-            break;
100
-        case 'wms':
101
-            $name = 'Written ministerial statements';
102
-            break;
103
-        case 'standing':
104
-            $name = 'Bill Committees';
105
-            break;
106
-        case 'future':
107
-            $name = 'Future Business';
108
-            break;
109
-        case 'ni':
110
-            $name = 'Northern Ireland Assembly Debates';
111
-            break;
112
-        case 'scotland':
113
-            $name = 'All Scotland';
114
-            break;
115
-        case 'sp':
116
-            $name = 'Scottish Parliament Debates';
117
-            break;
118
-        case 'spwrans':
119
-            $name = 'Scottish Parliament Written answers';
120
-            break;
85
+            case 'wrans':
86
+                $name = 'Written Answers';
87
+                break;
88
+            case 'uk':
89
+                $name = 'All UK';
90
+                break;
91
+            case 'debates':
92
+                $name = 'House of Commons debates';
93
+                break;
94
+            case 'whall':
95
+                $name = 'Westminster Hall debates';
96
+                break;
97
+            case 'lords':
98
+                $name = 'House of Lords debates';
99
+                break;
100
+            case 'wms':
101
+                $name = 'Written ministerial statements';
102
+                break;
103
+            case 'standing':
104
+                $name = 'Bill Committees';
105
+                break;
106
+            case 'future':
107
+                $name = 'Future Business';
108
+                break;
109
+            case 'ni':
110
+                $name = 'Northern Ireland Assembly Debates';
111
+                break;
112
+            case 'scotland':
113
+                $name = 'All Scotland';
114
+                break;
115
+            case 'sp':
116
+                $name = 'Scottish Parliament Debates';
117
+                break;
118
+            case 'spwrans':
119
+                $name = 'Scottish Parliament Written answers';
120
+                break;
121 121
         }
122 122
 
123 123
         return $name;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         $this->searchstring = $argparser->construct_search_string();
20 20
         $this->searchkeyword = $argparser->searchkeyword;
21 21
 
22
-        if ( !$this->searchstring ) {
22
+        if (!$this->searchstring) {
23 23
             $data = $this->get_form_params($data);
24 24
             $data['searchstring'] = '';
25 25
             $data['template'] = 'search/results';
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 
29 29
         $this->searchstring = filter_user_input($this->searchstring, 'strict');
30 30
         $warnings = $this->validate_search_string();
31
-        if ( $warnings ) {
31
+        if ($warnings) {
32 32
             $data['warnings'] = $warnings;
33 33
             $data['template'] = 'search/results';
34 34
             $data['searchstring'] = $this->searchstring;
35 35
             $data = $this->get_form_params($data);
36 36
             return $data;
37 37
         } else {
38
-            if (get_http_var('o')=='p') {
38
+            if (get_http_var('o') == 'p') {
39 39
                 $search = new Search\ByUsage();
40 40
                 $data = $search->search($this->searchstring);
41 41
                 $data['template'] = 'search/by-person';
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             $data['person_name'] = $MEMBER->full_name();
53 53
         }
54 54
 
55
-        if ( isset($data['info']['spelling_correction']) ) {
55
+        if (isset($data['info']['spelling_correction'])) {
56 56
             $data['info']['spelling_correction_display'] = $this->prettifySearchString($data['info']['spelling_correction']);
57 57
         }
58 58
 
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
         $data['search_keyword'] = $this->searchkeyword;
145 145
 
146 146
         $is_adv = false;
147
-        foreach ( array('to', 'from', 'person', 'section', 'column', 'phrase', 'exclude' ) as $var ) {
147
+        foreach (array('to', 'from', 'person', 'section', 'column', 'phrase', 'exclude') as $var) {
148 148
             $key = "search_$var";
149
-            $data[$key] = get_http_var( $var );
150
-            if ( $data[$key] ) {
149
+            $data[$key] = get_http_var($var);
150
+            if ($data[$key]) {
151 151
                 $is_adv = true;
152 152
             }
153 153
         }
154 154
 
155
-        if ( isset($data['search_section']) ) {
155
+        if (isset($data['search_section'])) {
156 156
             $data['search_section_pretty'] = $this->prettify_search_section($data['search_section']);
157 157
         }
158 158
 
@@ -162,16 +162,16 @@  discard block
 block discarded – undo
162 162
 
163 163
     private function set_wtt_options($data) {
164 164
         $data['wtt'] = '';
165
-        if ( $wtt = get_http_var('wtt') ) {
165
+        if ($wtt = get_http_var('wtt')) {
166 166
             $data['wtt'] = $wtt;
167
-            if ( $wtt == 2 && $pid = get_http_var('pid') ) {
167
+            if ($wtt == 2 && $pid = get_http_var('pid')) {
168 168
                 $data['pid'] = null;
169 169
                 try {
170 170
                     $lord = new Member(array('person_id' => $pid, 'house' => 2));
171
-                } catch ( MemberException $e ) {
171
+                } catch (MemberException $e) {
172 172
                     return $data;
173 173
                 }
174
-                if ( $lord->valid ) {
174
+                if ($lord->valid) {
175 175
                     $data['pid'] = $pid;
176 176
                     $data['wtt_lord_name'] = $lord->full_name();
177 177
                 }
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
             $url->insert(array('q' => $value));
197 197
         }
198 198
 
199
-        if ( $params ) {
200
-            if ( get_http_var('house') ) {
199
+        if ($params) {
200
+            if (get_http_var('house')) {
201 201
                 $url->insert(array('house' => get_http_var('house')));
202 202
             }
203
-            if ( get_http_var('wtt') ) {
203
+            if (get_http_var('wtt')) {
204 204
                 $url->insert(array('wtt' => get_http_var('wtt')));
205 205
             }
206 206
         } else {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         global $DATA, $this_page;
215 215
 
216 216
         $pagetitle = '';
217
-        if ( isset($data['search_type']) && $data['search_type'] == 'person' ) {
217
+        if (isset($data['search_type']) && $data['search_type'] == 'person') {
218 218
             if (isset($data['wtt']) && $data['wtt'] > 0) {
219 219
                 $pagetitle = 'League table of Lords who say ' . $data['pagetitle'];
220 220
             } else {
Please login to merge, or discard this patch.
classes/Homepage.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     }
49 49
 
50 50
     protected function getRegionalList() {
51
-        return NULL;
51
+        return null;
52 52
     }
53 53
 
54 54
     protected function getEditorialContent() {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
         $gid = $featured->get_gid();
58 58
         $gidCheck = new Gid($gid);
59 59
         $gid = $gidCheck->checkForRedirect();
60
-        if ( $gid ) {
60
+        if ($gid) {
61 61
             $title = $featured->get_title();
62 62
             $context = $featured->get_context();
63 63
             $related = $featured->get_related();
64 64
             $item = $this->getFeaturedDebate($gid, $title, $context, $related);
65 65
         } else {
66 66
             $item = $debatelist->display('recent_debates', array('days' => 7, 'num' => 1), 'none');
67
-            if ( isset($item['data']) && count($item['data']) ) {
67
+            if (isset($item['data']) && count($item['data'])) {
68 68
                 $item = $item['data'][0];
69 69
                 $more_url = new Url('debates');
70 70
                 $item['more_url'] = $more_url->generate();
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
         $item['featured'] = true;
96 96
 
97 97
         $related_debates = array();
98
-        foreach ( $related as $related_gid ) {
99
-            if ( $related_gid ) {
98
+        foreach ($related as $related_gid) {
99
+            if ($related_gid) {
100 100
                 $related_item = $debatelist->display('featured_gid', array('gid' => $related_gid), 'none');
101 101
                 $related_debates[] = $related_item['data'];
102 102
             }
@@ -121,21 +121,21 @@  discard block
 block discarded – undo
121 121
 
122 122
         $recent_content = array();
123 123
 
124
-        foreach ( $this->recent_types as $class => $recent ) {
124
+        foreach ($this->recent_types as $class => $recent) {
125 125
             $class = "\\$class";
126 126
             $instance = new $class();
127 127
             $more_url = new Url($recent[1]);
128
-            if ( $recent[0] == 'recent_pbc_debates' ) {
129
-                $content = array( 'data' => $instance->display($recent[0], array('num' => 5), 'none') );
128
+            if ($recent[0] == 'recent_pbc_debates') {
129
+                $content = array('data' => $instance->display($recent[0], array('num' => 5), 'none'));
130 130
             } else {
131 131
                 $content = $instance->display($recent[0], array('days' => 7, 'num' => 1), 'none');
132
-                if ( isset($content['data']) && count($content['data']) ) {
132
+                if (isset($content['data']) && count($content['data'])) {
133 133
                     $content = $content['data'][0];
134 134
                 } else {
135 135
                     $content = array();
136 136
                 }
137 137
             }
138
-            if ( $content ) {
138
+            if ($content) {
139 139
                 $content['more_url'] = $more_url->generate();
140 140
                 $content['desc'] = $recent[2];
141 141
                 $recent_content[] = $content;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             WHERE event_date >= :date
155 155
             AND deleted = 0
156 156
             ORDER BY event_date, chamber, pos",
157
-            array( ':date' => $date )
157
+            array(':date' => $date)
158 158
         );
159 159
 
160 160
         if (!$q->rows()) {
Please login to merge, or discard this patch.
classes/Utility/Hansard.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 class Hansard
12 12
 {
13 13
     public static function get_gid_from_url($url) {
14
-        $gid = NULL;
14
+        $gid = null;
15 15
         $parts = parse_url($url);
16 16
         parse_str($parts['query'], $query);
17 17
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
         $parts = parse_url($url);
16 16
         parse_str($parts['query'], $query);
17 17
 
18
-        if ( $query['id'] ) {
18
+        if ($query['id']) {
19 19
             if (strpos($parts['path'], 'lords') !== false) {
20 20
                 $gid = 'uk.org.publicwhip/lords/';
21 21
             } elseif (strpos($parts['path'], 'whall') !== false) {
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 
31 31
 
32 32
     public static function gid_to_url($gid) {
33
-        if ( !$gid ) {
33
+        if (!$gid) {
34 34
             return '';
35 35
         }
36 36
         global $hansardmajors;
37 37
         $db = new \ParlDB();
38 38
 
39
-        $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array( ':gid' => $gid ));
39
+        $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid));
40 40
         $url_gid = fix_gid_from_db($gid);
41 41
         $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q->field(0, 'major')]['page']);
42 42
         $url->insert(array('id' => $url_gid));
Please login to merge, or discard this patch.
classes/Utility/Gaze.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         if (defined('OPTION_GAZE_URL') && OPTION_GAZE_URL) {
26 26
             return gaze_get_country_from_ip($ip);
27 27
         } else {
28
-            return NULL;
28
+            return null;
29 29
         }
30 30
 
31 31
     }
Please login to merge, or discard this patch.
classes/Utility/Postcode.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 
40 40
         if ($last_postcode == $postcode) {
41 41
             $return_value = $mp_only ? $last_postcode_value['WMC'] : $last_postcode_value;
42
-            twfy_debug ("TIME", "Postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value ));
42
+            twfy_debug ("TIME", "postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value ));
43 43
             return $return_value;
44 44
         }
45 45
 
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         if ($last_postcode == $postcode) {
41 41
             $return_value = $mp_only ? $last_postcode_value['WMC'] : $last_postcode_value;
42
-            twfy_debug ("TIME", "Postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value ));
42
+            twfy_debug("TIME", "Postcode $postcode looked up last time, is " . (is_array($return_value) ? implode(', ', $return_value) : $return_value));
43 43
             return $return_value;
44 44
         }
45 45
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
             $name = $q->field(0, 'name');
76 76
             if (self::postcodeIsScottish($postcode)) {
77 77
                 $name = explode('|', $name);
78
-                if (count($name)==3)
78
+                if (count($name) == 3)
79 79
                     return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]);
80 80
             } elseif (self::postcodeIsNi($postcode)) {
81 81
                 $name = explode('|', $name);
82
-                if (count($name)==2)
82
+                if (count($name) == 2)
83 83
                     return array('WMC' => $name[0], 'NIE' => $name[1]);
84 84
             } else {
85 85
                 return array('WMC' => $name);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
         $r = json_decode($file, true);
115 115
         if (!$r) {
116
-            trigger_error("Postcode database is not working. Content:\n".$file.", request: ". $filename, E_USER_WARNING);
116
+            trigger_error("Postcode database is not working. Content:\n" . $file . ", request: " . $filename, E_USER_WARNING);
117 117
             return '';
118 118
         }
119 119
         if (isset($r['error']) || !isset($r['areas'])) {
@@ -179,29 +179,29 @@  discard block
 block discarded – undo
179 179
         if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE')))
180 180
             return true;
181 181
 
182
-        if ($m[1]=='DG') {
183
-            if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) return false; # A few postcodes in England
182
+        if ($m[1] == 'DG') {
183
+            if ($m[2] == 16 && $m[3] == 5 && in_array($m[4], array('HT', 'HU', 'HZ', 'JA', 'JB'))) return false; # A few postcodes in England
184 184
             return true;
185 185
         }
186 186
 
187 187
         # Damn postcodes crossing country boundaries
188
-        if ($m[1]=='TD') {
189
-            if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) return true; # TD1-8, 10-11, 13-14 all in Scotland
190
-            if ($m[2]==9) {
191
-                if ($m[3]!=0) return true; # TD9 1-9 all in Scotland
192
-                if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) return true; # Nearly all of TD9 0 in Scotland
188
+        if ($m[1] == 'TD') {
189
+            if ($m[2] != 15 && $m[2] != 12 && $m[2] != 9) return true; # TD1-8, 10-11, 13-14 all in Scotland
190
+            if ($m[2] == 9) {
191
+                if ($m[3] != 0) return true; # TD9 1-9 all in Scotland
192
+                if (!in_array($m[4], array('TJ', 'TP', 'TR', 'TS', 'TT', 'TU', 'TW'))) return true; # Nearly all of TD9 0 in Scotland
193 193
             }
194 194
             $m[5] = substr($m[4], 0, 1);
195
-            if ($m[2]==12) { # $m[3] will be 4 currently.
196
-                if ($m[4]=='XE') return true;
197
-                if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England
195
+            if ($m[2] == 12) { # $m[3] will be 4 currently.
196
+                if ($m[4] == 'XE') return true;
197
+                if (in_array($m[5], array('A', 'B', 'D', 'E', 'H', 'J', 'L', 'N', 'W', 'Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England
198 198
             }
199 199
             # TD15 is mostly England
200
-            if ($m[2]==15) {
201
-                if ($m[3]!=1) return false; # TD15 2 and 9 are in England
202
-                if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) return true;
203
-                if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') return true; # Most of TD15 1T* in Scotland
204
-                if ($m[5]=='X' && $m[4]!='XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland
200
+            if ($m[2] == 15) {
201
+                if ($m[3] != 1) return false; # TD15 2 and 9 are in England
202
+                if (in_array($m[4], array('BT', 'SU', 'SZ', 'UF', 'UG', 'UH', 'UJ', 'UL', 'US', 'UZ', 'WY', 'WZ'))) return true;
203
+                if ($m[5] == 'T' && $m[4] != 'TA' && $m[4] != 'TB') return true; # Most of TD15 1T* in Scotland
204
+                if ($m[5] == 'X' && $m[4] != 'XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland
205 205
             }
206 206
         }
207 207
 
Please login to merge, or discard this patch.
Braces   +61 added lines, -24 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
             $ret = self::postcodeFetchFromMapit($postcode);
53 53
         }
54 54
 
55
-        if (is_string($ret)) return $ret;
55
+        if (is_string($ret)) {
56
+            return $ret;
57
+        }
56 58
 
57 59
         $last_postcode = $postcode;
58 60
         $last_postcode_value = $ret;
@@ -75,12 +77,14 @@  discard block
 block discarded – undo
75 77
             $name = $q->field(0, 'name');
76 78
             if (self::postcodeIsScottish($postcode)) {
77 79
                 $name = explode('|', $name);
78
-                if (count($name)==3)
79
-                    return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]);
80
+                if (count($name)==3) {
81
+                                    return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]);
82
+                }
80 83
             } elseif (self::postcodeIsNi($postcode)) {
81 84
                 $name = explode('|', $name);
82
-                if (count($name)==2)
83
-                    return array('WMC' => $name[0], 'NIE' => $name[1]);
85
+                if (count($name)==2) {
86
+                                    return array('WMC' => $name[0], 'NIE' => $name[1]);
87
+                }
84 88
             } else {
85 89
                 return array('WMC' => $name);
86 90
             }
@@ -121,8 +125,9 @@  discard block
 block discarded – undo
121 125
         }
122 126
         $areas = array();
123 127
         foreach ($r['areas'] as $row) {
124
-            if (in_array($row['type'], array('WMC', 'SPC', 'SPE', 'NIE')))
125
-                $areas[$row['type']] = $row['name'];
128
+            if (in_array($row['type'], array('WMC', 'SPC', 'SPE', 'NIE'))) {
129
+                            $areas[$row['type']] = $row['name'];
130
+            }
126 131
         }
127 132
 
128 133
         if (!isset($areas['WMC'])) {
@@ -172,36 +177,67 @@  discard block
 block discarded – undo
172 177
      */
173 178
 
174 179
     public static function postcodeIsScottish($pc) {
175
-        if (!preg_match('#^([A-Z]{1,2})(\d+) (\d)([A-Z]{2})#', self::canonicalisePostcode($pc), $m))
176
-            return false;
180
+        if (!preg_match('#^([A-Z]{1,2})(\d+) (\d)([A-Z]{2})#', self::canonicalisePostcode($pc), $m)) {
181
+                    return false;
182
+        }
177 183
 
178 184
         # Check for Scottish postal areas
179
-        if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE')))
180
-            return true;
185
+        if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE'))) {
186
+                    return true;
187
+        }
181 188
 
182 189
         if ($m[1]=='DG') {
183
-            if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) return false; # A few postcodes in England
190
+            if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) {
191
+                return false;
192
+            }
193
+            # A few postcodes in England
184 194
             return true;
185 195
         }
186 196
 
187 197
         # Damn postcodes crossing country boundaries
188 198
         if ($m[1]=='TD') {
189
-            if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) return true; # TD1-8, 10-11, 13-14 all in Scotland
199
+            if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) {
200
+                return true;
201
+            }
202
+            # TD1-8, 10-11, 13-14 all in Scotland
190 203
             if ($m[2]==9) {
191
-                if ($m[3]!=0) return true; # TD9 1-9 all in Scotland
192
-                if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) return true; # Nearly all of TD9 0 in Scotland
204
+                if ($m[3]!=0) {
205
+                    return true;
206
+                }
207
+                # TD9 1-9 all in Scotland
208
+                if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) {
209
+                    return true;
210
+                }
211
+                # Nearly all of TD9 0 in Scotland
193 212
             }
194 213
             $m[5] = substr($m[4], 0, 1);
195
-            if ($m[2]==12) { # $m[3] will be 4 currently.
196
-                if ($m[4]=='XE') return true;
197
-                if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England
214
+            if ($m[2]==12) {
215
+# $m[3] will be 4 currently.
216
+                if ($m[4]=='XE') {
217
+                    return true;
218
+                }
219
+                if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) {
220
+                    return true;
221
+                }
222
+                # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England
198 223
             }
199 224
             # TD15 is mostly England
200 225
             if ($m[2]==15) {
201
-                if ($m[3]!=1) return false; # TD15 2 and 9 are in England
202
-                if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) return true;
203
-                if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') return true; # Most of TD15 1T* in Scotland
204
-                if ($m[5]=='X' && $m[4]!='XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland
226
+                if ($m[3]!=1) {
227
+                    return false;
228
+                }
229
+                # TD15 2 and 9 are in England
230
+                if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) {
231
+                    return true;
232
+                }
233
+                if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') {
234
+                    return true;
235
+                }
236
+                # Most of TD15 1T* in Scotland
237
+                if ($m[5]=='X' && $m[4]!='XX') {
238
+                    return true;
239
+                }
240
+                # TD15 1XX in England, rest of TD15 1X* in Scotland
205 241
             }
206 242
         }
207 243
 
@@ -215,8 +251,9 @@  discard block
 block discarded – undo
215 251
 
216 252
     public static function postcodeIsNi($pc) {
217 253
         $prefix = substr(self::canonicalisePostcode($pc), 0, 2);
218
-        if ($prefix == 'BT')
219
-            return true;
254
+        if ($prefix == 'BT') {
255
+                    return true;
256
+        }
220 257
         return false;
221 258
     }
222 259
 
Please login to merge, or discard this patch.
classes/SPHomepage.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     }
39 39
 
40 40
     protected function getCalendarData() {
41
-        return NULL;
41
+        return null;
42 42
     }
43 43
 
44 44
 
Please login to merge, or discard this patch.
classes/AlertView.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
     protected $db;
12 12
     protected $alert;
13 13
 
14
-    public function __construct($THEUSER = NULL) {
14
+    public function __construct($THEUSER = null) {
15 15
         $this->user = $THEUSER;
16 16
         $this->db = new \ParlDB;
17 17
         $this->alert = new \ALERT;
Please login to merge, or discard this patch.
classes/Topic.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      *
29 29
      */
30 30
 
31
-    public function __construct($data = NULL)
31
+    public function __construct($data = null)
32 32
     {
33 33
         $this->db = new \ParlDB;
34 34
 
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $this->db = new \ParlDB;
34 34
 
35 35
         if (is_null($data)) {
36
-          return;
36
+            return;
37 37
         }
38 38
 
39 39
         $this->id = $data['id'];
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
     private function _getContentIDs() {
126 126
         $q = $this->db->query(
127
-          "SELECT body, gid, ep.epobject_id FROM epobject ep
127
+            "SELECT body, gid, ep.epobject_id FROM epobject ep
128 128
            JOIN hansard h on ep.epobject_id = h.epobject_id
129 129
            JOIN topic_epobjects te on te.epobject_id = ep.epobject_id
130 130
            WHERE topic_key = :topic_key",
@@ -180,24 +180,24 @@  discard block
 block discarded – undo
180 180
 
181 181
     public function addContent($gid) {
182 182
         $q = $this->db->query(
183
-          "SELECT epobject_id FROM hansard WHERE gid = :gid",
184
-          array(
183
+            "SELECT epobject_id FROM hansard WHERE gid = :gid",
184
+            array(
185 185
             ":gid" => $gid
186
-          )
186
+            )
187 187
         );
188 188
 
189 189
         if (!$q->success() || $q->rows == 0) {
190
-          return false;
190
+            return false;
191 191
         }
192 192
 
193 193
         $epobject_id = $q->field(0, 'epobject_id');
194 194
 
195 195
         $q = $this->db->query(
196
-          "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)",
197
-          array(
196
+            "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)",
197
+            array(
198 198
             ":topic" => $this->id,
199 199
             ":ep_id" => $epobject_id
200
-          )
200
+            )
201 201
         );
202 202
 
203 203
         return $q->success();
@@ -205,31 +205,31 @@  discard block
 block discarded – undo
205 205
 
206 206
     public function deleteContent($id) {
207 207
         $q = $this->db->query(
208
-          "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id",
209
-          array(
208
+            "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id",
209
+            array(
210 210
             ":topic" => $this->id,
211 211
             ":ep_id" => $id
212
-          )
212
+            )
213 213
         );
214 214
 
215 215
         return $q->success();
216 216
     }
217 217
 
218 218
     public function getPolicySets() {
219
-      $q = $this->db->query(
219
+        $q = $this->db->query(
220 220
         "SELECT policyset FROM topic_policysets WHERE topic_key = :key",
221 221
         array(
222
-          ':key' => $this->id
222
+            ':key' => $this->id
223 223
         )
224
-      );
224
+        );
225 225
 
226
-      $sets = array();
227
-      $count = $q->rows;
228
-      for ($i = 0; $i < $count; $i++) {
226
+        $sets = array();
227
+        $count = $q->rows;
228
+        for ($i = 0; $i < $count; $i++) {
229 229
         $sets[] = $q->field($i, 'policyset');
230
-      }
230
+        }
231 231
 
232
-      return $sets;
232
+        return $sets;
233 233
     }
234 234
 
235 235
     public function addPolicySets($sets) {
@@ -259,20 +259,20 @@  discard block
 block discarded – undo
259 259
     }
260 260
 
261 261
     public function getPolicies() {
262
-      $q = $this->db->query(
262
+        $q = $this->db->query(
263 263
         'SELECT policy_id FROM topic_policies WHERE topic_key = :key',
264 264
         array(
265
-          ':key' => $this->id
265
+            ':key' => $this->id
266 266
         )
267
-      );
267
+        );
268 268
 
269
-      $policies = array();
270
-      $count = $q->rows;
271
-      for ($i = 0; $i < $count; $i++) {
269
+        $policies = array();
270
+        $count = $q->rows;
271
+        for ($i = 0; $i < $count; $i++) {
272 272
         $policies[] = $q->field($i, 'policy_id');
273
-      }
273
+        }
274 274
 
275
-      return $policies;
275
+        return $policies;
276 276
     }
277 277
 
278 278
     public function addPolicies($policies) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
     public function save() {
318 318
         $q = $this->db->query(
319
-          "REPLACE INTO topics
319
+            "REPLACE INTO topics
320 320
           (id, title, slug, description, search_string, front_page, image)
321 321
           VALUES
322 322
           (:id, :title, :slug, :description, :search_string, :front_page, :image)",
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function sctitle() {
55 55
         $title = $this->title;
56
-        if (strpos($title, 'The ') === 0 ) {
56
+        if (strpos($title, 'The ') === 0) {
57 57
             $title = lcfirst($title);
58 58
         }
59 59
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             );
243 243
         } else {
244 244
             foreach ($sets as $set) {
245
-                if ($set == '' ) {
245
+                if ($set == '') {
246 246
                     continue;
247 247
                 }
248 248
                 $q = $this->db->query(
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             );
286 286
         } else {
287 287
             foreach ($policies as $policy) {
288
-                if ($policy == '' ) {
288
+                if ($policy == '') {
289 289
                     continue;
290 290
                 }
291 291
                 $q = $this->db->query(
Please login to merge, or discard this patch.
classes/SectionView/PbcView.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
         } elseif ($this->session) {
66 66
             # Display the bills for a particular session
67 67
             $this_page = 'pbc_session';
68
-            $DATA->set_page_metadata($this_page, 'title', "Session $this->session");
68
+            $DATA->set_page_metadata($this_page, 'title', "session $this->session");
69 69
             $args = array (
70 70
                 'session' => $this->session,
71 71
             );
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         } elseif ($bill_id) {
48 48
             # Display the page for a particular bill
49 49
             $this_page = 'pbc_bill';
50
-            $args = array (
50
+            $args = array(
51 51
                 'id' => $bill_id,
52 52
                 'title' => $this->bill,
53 53
                 'session' => $this->session,
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             # Display the bills for a particular session
67 67
             $this_page = 'pbc_session';
68 68
             $DATA->set_page_metadata($this_page, 'title', "Session $this->session");
69
-            $args = array (
69
+            $args = array(
70 70
                 'session' => $this->session,
71 71
             );
72 72
             $data = array();
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 
89 89
     protected function getSearchSections() {
90 90
         return array(
91
-            array( 'section' => 'pbc' )
91
+            array('section' => 'pbc')
92 92
         );
93 93
     }
94 94
 
95 95
     protected function front_content() {
96
-        return $this->list->display( 'recent_pbc_debates', array( 'num' => 50 ), 'none' );
96
+        return $this->list->display('recent_pbc_debates', array('num' => 50), 'none');
97 97
     }
98 98
 
99 99
     protected function display_front() {
Please login to merge, or discard this patch.