Failed Conditions
Pull Request — master (#1325)
by Nick
26:10 queued 21:10
created
www/docs/api/api_getAlerts.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function api_getAlerts_start_date($start_date) {
4
-  $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date'));
5
-  $alert = new ALERT();
6
-  $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']);
7
-  api_output($data);
4
+    $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date'));
5
+    $alert = new ALERT();
6
+    $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']);
7
+    api_output($data);
8 8
 }
9 9
 
10 10
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function api_getAlerts_start_date($start_date) {
4
-  $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date'));
4
+  $args = array('start_date' => $start_date, 'end_date' => get_http_var('end_date'));
5 5
   $alert = new ALERT();
6
-  $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']);
6
+  $data = $alert->fetch_between($confirmed = 1, $deleted = 0, $args['start_date'], $args['end_date']);
7 7
   api_output($data);
8 8
 }
9 9
 
Please login to merge, or discard this patch.
www/docs/api/api_getConstituency.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once INCLUDESPATH . '../../commonlib/phplib/mapit.php';
3
+include_once INCLUDESPATH.'../../commonlib/phplib/mapit.php';
4 4
 
5 5
 function api_getConstituency_front() {
6 6
 ?>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     $q = $db->query("select constituency, data_key, data_value from consinfo
61 61
                      where constituency = :constituency", array(':constituency' => $constituency));
62 62
     if ($q->rows()) {
63
-        for ($i=0; $i<$q->rows(); $i++) {
63
+        for ($i = 0; $i < $q->rows(); $i++) {
64 64
             $data_key = $q->field($i, 'data_key');
65 65
             $output[$data_key] = $q->field($i, 'data_value');
66 66
         }
Please login to merge, or discard this patch.
www/docs/api/api_getMPInfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once dirname(__FILE__) . '/api_getMPsInfo.php';
3
+include_once dirname(__FILE__).'/api_getMPsInfo.php';
4 4
 
5 5
 function api_getMPInfo_front() {
6 6
 ?>
Please login to merge, or discard this patch.
www/docs/api/api_getMLAs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once dirname(__FILE__) . '/api_getMembers.php';
3
+include_once dirname(__FILE__).'/api_getMembers.php';
4 4
 
5 5
 function api_getMLAs_front() {
6 6
 ?>
Please login to merge, or discard this patch.
www/docs/api/api_getMembers.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
     $q = $db->query($sql, $params);
9 9
     $output = array();
10 10
     $last_mod = 0;
11
-    for ($i=0; $i<$q->rows(); $i++) {
11
+    for ($i = 0; $i < $q->rows(); $i++) {
12 12
         $pid = $q->field($i, 'person_id');
13 13
         $row = array(
14 14
             'member_id' => $q->field($i, 'member_id'),
15 15
             'person_id' => $pid,
16 16
             'name' => html_entity_decode(member_full_name($q->field($i, 'house'), $q->field($i, 'title'),
17 17
                 $q->field($i, 'given_name'), $q->field($i, 'family_name'),
18
-                $q->field($i, 'lordofname') )),
18
+                $q->field($i, 'lordofname'))),
19 19
             'party' => isset($parties[$q->field($i, 'party')]) ? $parties[$q->field($i, 'party')] : $q->field($i, 'party'),
20 20
         );
21 21
         if ($q->field($i, 'house') != 2) {
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
     $pids = array_keys($output);
32 32
     if (count($pids)) {
33 33
         $q = $db->query('SELECT person, dept, position, from_date, to_date FROM moffice
34
-            WHERE to_date="9999-12-31" AND person IN (' . join(',', $pids) . ')');
35
-        for ($i=0; $i<$q->rows(); $i++) {
34
+            WHERE to_date="9999-12-31" AND person IN (' . join(',', $pids).')');
35
+        for ($i = 0; $i < $q->rows(); $i++) {
36 36
             $row = $q->row($i);
37 37
             $pid = $row['person'];
38 38
             unset($row['person']);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             AND p.start_date <= date(now()) and date(now()) <= p.end_date
56 56
         and party like :party and entered_house <= date(now()) and date(now()) <= left_house', array(
57 57
             ':house' => $house,
58
-            ':party' => '%' . $s . '%'
58
+            ':party' => '%'.$s.'%'
59 59
             ));
60 60
 }
61 61
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 
75 75
     _api_getMembers_output($query, array(
76 76
         ':house' => $house,
77
-        ':name' => '%' . $s . '%'
77
+        ':name' => '%'.$s.'%'
78 78
         ));
79 79
 }
80 80
 
81 81
 function api_getMembers_date($house, $date) {
82 82
     if ($date = parse_date($date)) {
83
-        api_getMembers($house, '"' . $date['iso'] . '"');
83
+        api_getMembers($house, '"'.$date['iso'].'"');
84 84
     } else {
85 85
         api_error('Invalid date format');
86 86
     }
Please login to merge, or discard this patch.
www/docs/api/api_getDebates.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once dirname(__FILE__) . '/api_getHansard.php';
3
+include_once dirname(__FILE__).'/api_getHansard.php';
4 4
 
5 5
 function api_getDebates_front() {
6 6
 ?>
Please login to merge, or discard this patch.
www/docs/api/api_getMSP.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once INCLUDESPATH . 'easyparliament/member.php';
4
-include_once dirname(__FILE__) . '/api_getPerson.php';
3
+include_once INCLUDESPATH.'easyparliament/member.php';
4
+include_once dirname(__FILE__).'/api_getPerson.php';
5 5
 
6 6
 function api_getMSP_front() {
7 7
 ?>
Please login to merge, or discard this patch.
www/docs/api/api_getMP.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once INCLUDESPATH . 'easyparliament/member.php';
4
-include_once dirname(__FILE__) . '/api_getPerson.php';
3
+include_once INCLUDESPATH.'easyparliament/member.php';
4
+include_once dirname(__FILE__).'/api_getPerson.php';
5 5
 
6 6
 function api_getMP_front() {
7 7
 ?>
Please login to merge, or discard this patch.
www/docs/api/api_getGeometry.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once INCLUDESPATH . '../../commonlib/phplib/mapit.php';
3
+include_once INCLUDESPATH.'../../commonlib/phplib/mapit.php';
4 4
 
5 5
 function api_getGeometry_front() {
6 6
 ?>
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
     return null;
67 67
 }
68 68
 
69
-function _api_cacheCheck($fn, $arg='') {
70
-    $cache = INCLUDESPATH . '../docs/api/cache/' . $fn;
69
+function _api_cacheCheck($fn, $arg = '') {
70
+    $cache = INCLUDESPATH.'../docs/api/cache/'.$fn;
71 71
     if (is_file($cache))
72 72
         return unserialize(file_get_contents($cache));
73 73
     $out = mapit_call($fn, $arg);
@@ -83,58 +83,58 @@  discard block
 block discarded – undo
83 83
 function _api_ni_centroids() {
84 84
     return array(
85 85
         # East Londonderry
86
-        66129 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907 ),
87
-        14276 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907 ),
86
+        66129 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907),
87
+        14276 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907),
88 88
         # Foyle
89
-        66131 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456 ),
90
-        14273 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456 ),
89
+        66131 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456),
90
+        14273 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456),
91 91
         # West Tyrone
92
-        66141 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278 ),
93
-        14292 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278 ),
92
+        66141 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278),
93
+        14292 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278),
94 94
         # Fermanagh &amp; South Tyrone
95
-        14296 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237 ),
96
-        66130 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237 ),
95
+        14296 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237),
96
+        66130 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237),
97 97
         # Newry &amp; Armagh
98
-        14303 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770 ),
99
-        66134 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770 ),
98
+        14303 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770),
99
+        66134 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770),
100 100
         # Upper Bann
101
-        14300 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098 ),
102
-        66140 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098 ),
101
+        14300 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098),
102
+        66140 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098),
103 103
         # South Down
104
-        14306 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344 ),
105
-        66138 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344 ),
104
+        14306 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344),
105
+        66138 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344),
106 106
         # Lagan Valley
107
-        14309 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398 ),
108
-        66132 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398 ),
107
+        14309 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398),
108
+        66132 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398),
109 109
         # Strangford
110
-        14312 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343 ),
111
-        66139 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343 ),
110
+        14312 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343),
111
+        66139 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343),
112 112
         # North Down
113
-        14325 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384 ),
114
-        66136 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384 ),
113
+        14325 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384),
114
+        66136 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384),
115 115
         # South Antrim
116
-        14318 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905 ),
117
-        66137 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905 ),
116
+        14318 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905),
117
+        66137 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905),
118 118
         # East Antrim
119
-        66128 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179 ),
120
-        14284 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179 ),
119
+        66128 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179),
120
+        14284 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179),
121 121
         # North Antrim
122
-        66135 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125 ),
123
-        14280 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125 ),
122
+        66135 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125),
123
+        14280 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125),
124 124
         # Mid Ulster
125
-        66133 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044 ),
126
-        14288 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044 ),
125
+        66133 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044),
126
+        14288 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044),
127 127
         # Belfast North
128
-        14321 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511 ),
129
-        66125 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511 ),
128
+        14321 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511),
129
+        66125 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511),
130 130
         # Belfast East
131
-        14329 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792 ),
132
-        66124 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792 ),
131
+        14329 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792),
132
+        66124 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792),
133 133
         # Belfast South
134
-        14331 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064 ),
135
-        66126 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064 ),
134
+        14331 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064),
135
+        66126 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064),
136 136
         # Belfast West
137
-        14315 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650 ),
138
-        66127 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650 ),
137
+        14315 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650),
138
+        66127 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650),
139 139
     );
140 140
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,13 +38,17 @@  discard block
 block discarded – undo
38 38
 
39 39
 function api_getGeometry_name($name) {
40 40
     $out = _api_getGeometry_name($name);
41
-    if ($out) api_output($out);
42
-    else api_error('Name not recognised');
43
-}
41
+    if ($out) {
42
+        api_output($out);
43
+    } else {
44
+        api_error('Name not recognised');
45
+    }
46
+    }
44 47
 
45 48
 function _api_getGeometry_name($name) {
46
-    if (!defined('OPTION_MAPIT_URL') || !OPTION_MAPIT_URL)
47
-        return null;
49
+    if (!defined('OPTION_MAPIT_URL') || !OPTION_MAPIT_URL) {
50
+            return null;
51
+    }
48 52
 
49 53
     $name = MySociety\TheyWorkForYou\Utility\Constituencies::normaliseConstituencyName($name);
50 54
 
@@ -68,8 +72,9 @@  discard block
 block discarded – undo
68 72
 
69 73
 function _api_cacheCheck($fn, $arg='') {
70 74
     $cache = INCLUDESPATH . '../docs/api/cache/' . $fn;
71
-    if (is_file($cache))
72
-        return unserialize(file_get_contents($cache));
75
+    if (is_file($cache)) {
76
+            return unserialize(file_get_contents($cache));
77
+    }
73 78
     $out = mapit_call($fn, $arg);
74 79
     $fp = fopen($cache, 'w');
75 80
     if ($fp) {
Please login to merge, or discard this patch.