@@ -22,7 +22,7 @@ |
||
22 | 22 | // Build a SoqlQuery with functions |
23 | 23 | $soql = new SoqlQuery(); |
24 | 24 | $soql->where("within_circle(incident_location, {$_POST['latitude']}, {$_POST['longitude']}, {$_POST['range']})") |
25 | - ->limit(20); |
|
25 | + ->limit(20); |
|
26 | 26 | |
27 | 27 | // Get the dataset. $results is now an associative array in the same format as the JSON object |
28 | 28 | $results = $ds->getDataset($soql); |
@@ -67,7 +67,7 @@ |
||
67 | 67 | </tr> |
68 | 68 | |
69 | 69 | <?php // Loop through all of the results from the dataset ?> |
70 | - <?php foreach($results as $row) { ?> |
|
70 | + <?php foreach ($results as $row) { ?> |
|
71 | 71 | <tr> |
72 | 72 | <?php $timestamp = new DateTime($row["event_clearance_date"]); ?> |
73 | 73 | <td><?= $timestamp->format('Y-m-d h:ia') ?></td> |
@@ -37,7 +37,9 @@ discard block |
||
37 | 37 | <body> |
38 | 38 | <h1>Seattle Police Department 911 Incident Response</h1> |
39 | 39 | |
40 | - <?php if (!$postBack) { ?> |
|
40 | + <?php if (!$postBack) |
|
41 | +{ |
|
42 | +?> |
|
41 | 43 | <form method="POST"> |
42 | 44 | <p>Query for all of the Seattle Fire 911 Calls calls within 500 meters of the Socrata offices in Seattle:</p> |
43 | 45 | <p>Try 47.59815, -122.334540 with a range of 500 meters</p> |
@@ -56,7 +58,10 @@ discard block |
||
56 | 58 | |
57 | 59 | <input type="submit" value="Submit"/> |
58 | 60 | </form> |
59 | - <?php } else { ?> |
|
61 | + <?php } |
|
62 | +else |
|
63 | +{ |
|
64 | +?> |
|
60 | 65 | <h2>Results</h2> |
61 | 66 | |
62 | 67 | <?php // Create a table for our actual data ?> |
@@ -67,7 +72,9 @@ discard block |
||
67 | 72 | </tr> |
68 | 73 | |
69 | 74 | <?php // Loop through all of the results from the dataset ?> |
70 | - <?php foreach($results as $row) { ?> |
|
75 | + <?php foreach($results as $row) |
|
76 | +{ |
|
77 | +?> |
|
71 | 78 | <tr> |
72 | 79 | <?php $timestamp = new DateTime($row["event_clearance_date"]); ?> |
73 | 80 | <td><?= $timestamp->format('Y-m-d h:ia') ?></td> |
@@ -272,9 +272,9 @@ |
||
272 | 272 | * |
273 | 273 | * @return string The API URL |
274 | 274 | */ |
275 | - private function buildApiUrl ($location, $identifier = NULL) |
|
275 | + private function buildApiUrl ($location, $identifier = null) |
|
276 | 276 | { |
277 | - if ($identifier === NULL) |
|
277 | + if ($identifier === null) |
|
278 | 278 | { |
279 | 279 | $identifier = $this->resourceId; |
280 | 280 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @since 0.1.0 |
92 | 92 | * |
93 | - * @return double The API version number |
|
93 | + * @return integer The API version number |
|
94 | 94 | */ |
95 | 95 | public function getApiVersion () |
96 | 96 | { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | /** |
137 | 137 | * Fetch a dataset based on a resource ID. |
138 | 138 | * |
139 | - * @param string|SoqlQuery $filterOrSoqlQuery A simple filter or a SoqlQuery to filter the results |
|
139 | + * @param SoqlQuery $filterOrSoqlQuery A simple filter or a SoqlQuery to filter the results |
|
140 | 140 | * |
141 | 141 | * @see SodaClient::enableAssociativeArrays() |
142 | 142 | * @see SodaClient::disableAssociativeArrays() |
@@ -340,7 +340,7 @@ |
||
340 | 340 | $headers = array(); |
341 | 341 | |
342 | 342 | // For a single row, the format is the `resourceID/rowID.json`, so we'll use that as the "location" of the Api URL |
343 | - $apiEndPoint = $this->buildApiUrl("resource", $this->resourceId . "/" . $rowID); |
|
343 | + $apiEndPoint = $this->buildApiUrl("resource", $this->resourceId."/".$rowID); |
|
344 | 344 | |
345 | 345 | $urlQuery = new UrlQuery($apiEndPoint, $this->sodaClient->getToken(), $this->sodaClient->getEmail(), $this->sodaClient->getPassword()); |
346 | 346 | $urlQuery->setOAuth2Token($this->sodaClient->getOAuth2Token()); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | /** |
21 | 21 | * The ascending clause Socrata expects |
22 | 22 | */ |
23 | - const ASC = 'ASC'; |
|
23 | + const ASC = 'ASC'; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * The descending clause Socrata expects |
@@ -90,10 +90,10 @@ |
||
90 | 90 | |
91 | 91 | // Build up the headers we'll need to pass |
92 | 92 | $this->headers = array( |
93 | - 'Accept: application/json', |
|
94 | - 'Content-type: application/json', |
|
95 | - 'X-App-Token: ' . $this->token |
|
96 | - ); |
|
93 | + 'Accept: application/json', |
|
94 | + 'Content-type: application/json', |
|
95 | + 'X-App-Token: ' . $this->token |
|
96 | + ); |
|
97 | 97 | |
98 | 98 | $this->configureCurl($email, $password); |
99 | 99 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return mixed An associative array matching the returned JSON result or an StdClass object |
139 | 139 | */ |
140 | - public function sendGet ($params, $associativeArray, &$headers = NULL) |
|
140 | + public function sendGet ($params, $associativeArray, &$headers = null) |
|
141 | 141 | { |
142 | 142 | if (is_array($params)) |
143 | 143 | { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return mixed An associative array matching the returned JSON result or an StdClass object |
174 | 174 | */ |
175 | - public function sendPost ($dataAsJson, $associativeArray, &$headers = NULL) |
|
175 | + public function sendPost ($dataAsJson, $associativeArray, &$headers = null) |
|
176 | 176 | { |
177 | 177 | $this->setPostFields($dataAsJson); |
178 | 178 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @return mixed An associative array matching the returned JSON result or an StdClass object |
200 | 200 | */ |
201 | - public function sendPut ($dataAsJson, $associativeArray, &$headers = NULL) |
|
201 | + public function sendPut ($dataAsJson, $associativeArray, &$headers = null) |
|
202 | 202 | { |
203 | 203 | $this->setPostFields($dataAsJson); |
204 | 204 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return mixed An associative array matching the returned JSON result or an StdClass object |
222 | 222 | */ |
223 | - public function sendDelete ($associativeArray, &$headers = NULL) |
|
223 | + public function sendDelete ($associativeArray, &$headers = null) |
|
224 | 224 | { |
225 | 225 | curl_setopt($this->cURL, CURLOPT_CUSTOMREQUEST, "DELETE"); |
226 | 226 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | if ($ignoreReturn) |
268 | 268 | { |
269 | - return NULL; |
|
269 | + return null; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | $resultArray = $this->handleResponseBody($body, $result); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | */ |
366 | 366 | private function saveHeaders ($header, &$headers) |
367 | 367 | { |
368 | - if ($headers === NULL) |
|
368 | + if ($headers === null) |
|
369 | 369 | { |
370 | 370 | return; |
371 | 371 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $this->headers = array( |
93 | 93 | 'Accept: application/json', |
94 | 94 | 'Content-type: application/json', |
95 | - 'X-App-Token: ' . $this->token |
|
95 | + 'X-App-Token: '.$this->token |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | $this->configureCurl($email, $password); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | if (!StringUtilities::isNullOrEmpty($token)) |
120 | 120 | { |
121 | 121 | $this->oAuth2Token = $token; |
122 | - $this->headers[] = "Authorization: OAuth " . $this->oAuth2Token; |
|
122 | + $this->headers[] = "Authorization: OAuth ".$this->oAuth2Token; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | else if (!empty($params)) |
148 | 148 | { |
149 | - $full_url = $this->url . "?" . $params; |
|
149 | + $full_url = $this->url."?".$params; |
|
150 | 150 | } |
151 | 151 | else |
152 | 152 | { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | { |
296 | 296 | curl_setopt_array($this->cURL, array( |
297 | 297 | CURLOPT_HTTPAUTH => CURLAUTH_BASIC, |
298 | - CURLOPT_USERPWD => $email . ":" . $password |
|
298 | + CURLOPT_USERPWD => $email.":".$password |
|
299 | 299 | )); |
300 | 300 | } |
301 | 301 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | |
399 | 399 | if (count($params) > 0) |
400 | 400 | { |
401 | - $full_url .= "?" . implode("&", $params); |
|
401 | + $full_url .= "?".implode("&", $params); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | return $full_url; |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | |
436 | 436 | foreach ($params as $key => $value) |
437 | 437 | { |
438 | - $parameters[] = rawurlencode($key) . "=" . rawurlencode($value); |
|
438 | + $parameters[] = rawurlencode($key)."=".rawurlencode($value); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | return $parameters; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * @throws \allejo\Socrata\Exceptions\HttpException If the $body returned was not a JSON object |
341 | 341 | * @throws \allejo\Socrata\Exceptions\SodaException The returned JSON object in the $body was a SODA API error |
342 | 342 | * |
343 | - * @return mixed An associative array of the decoded JSON response |
|
343 | + * @return string An associative array of the decoded JSON response |
|
344 | 344 | */ |
345 | 345 | private function handleResponseBody ($body, $result) |
346 | 346 | { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | * Build a URL with GET parameters formatted into the URL |
395 | 395 | * |
396 | 396 | * @param string $url The base URL |
397 | - * @param array $params The GET parameters that need to be appended to the base URL |
|
397 | + * @param string[] $params The GET parameters that need to be appended to the base URL |
|
398 | 398 | * |
399 | 399 | * @since 0.1.0 |
400 | 400 | * |
@@ -87,7 +87,9 @@ |
||
87 | 87 | * |
88 | 88 | * @since 0.1.0 |
89 | 89 | */ |
90 | - public function __construct () {} |
|
90 | + public function __construct () |
|
91 | + { |
|
92 | +} |
|
91 | 93 | |
92 | 94 | /** |
93 | 95 | * Convert the current information into a URL encoded query that can be appended to the domain |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | foreach ($array as $key => $value) |
168 | 168 | { |
169 | - if(is_string($key) && !is_null($value)) |
|
169 | + if (is_string($key) && !is_null($value)) |
|
170 | 170 | { |
171 | 171 | $formattedValues[] = rawurlencode(sprintf($format, trim($key), trim($value))); |
172 | 172 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function order ($column, $direction = self::DEFAULT_ORDER_DIRECTION) |
245 | 245 | { |
246 | - $this->queryElements[self::ORDER_KEY][] = rawurlencode($column . " " . $direction); |
|
246 | + $this->queryElements[self::ORDER_KEY][] = rawurlencode($column." ".$direction); |
|
247 | 247 | |
248 | 248 | return $this; |
249 | 249 | } |
@@ -26,6 +26,6 @@ |
||
26 | 26 | */ |
27 | 27 | public function __construct ($filename) |
28 | 28 | { |
29 | - $this->message = "The following file could not be found or opened: " . $filename; |
|
29 | + $this->message = "The following file could not be found or opened: ".$filename; |
|
30 | 30 | } |
31 | 31 | } |